summaryrefslogtreecommitdiffstats
path: root/statuses
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-11 22:02:43 -0700
committerAndrew Godwin2022-11-11 22:02:43 -0700
commitfeb5d9b74fa1e8454eaaf29afae3643c6d7c81f1 (patch)
tree3889a826dfc2c852aa4873daff2a27cb7c1a2b01 /statuses
parentfbfad9fbf5e061cb7c658dada3c4014c9796021c (diff)
downloadtakahe-feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1.tar.gz
takahe-feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1.tar.bz2
takahe-feb5d9b74fa1e8454eaaf29afae3643c6d7c81f1.zip
Got up to incoming posts working
Diffstat (limited to 'statuses')
-rw-r--r--statuses/__init__.py0
-rw-r--r--statuses/admin.py8
-rw-r--r--statuses/apps.py6
-rw-r--r--statuses/migrations/0001_initial.py56
-rw-r--r--statuses/migrations/__init__.py0
-rw-r--r--statuses/models/__init__.py1
-rw-r--r--statuses/models/status.py42
-rw-r--r--statuses/views/__init__.py0
-rw-r--r--statuses/views/home.py35
9 files changed, 0 insertions, 148 deletions
diff --git a/statuses/__init__.py b/statuses/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/statuses/__init__.py
+++ /dev/null
diff --git a/statuses/admin.py b/statuses/admin.py
deleted file mode 100644
index 040a0eb..0000000
--- a/statuses/admin.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from django.contrib import admin
-
-from statuses.models import Status
-
-
-@admin.register(Status)
-class StatusAdmin(admin.ModelAdmin):
- pass
diff --git a/statuses/apps.py b/statuses/apps.py
deleted file mode 100644
index b0a694e..0000000
--- a/statuses/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class StatusesConfig(AppConfig):
- default_auto_field = "django.db.models.BigAutoField"
- name = "statuses"
diff --git a/statuses/migrations/0001_initial.py b/statuses/migrations/0001_initial.py
deleted file mode 100644
index c4a8fec..0000000
--- a/statuses/migrations/0001_initial.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-10 05:58
-
-import django.db.models.deletion
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ("users", "0001_initial"),
- ]
-
- operations = [
- migrations.CreateModel(
- name="Status",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- ("local", models.BooleanField()),
- ("uri", models.CharField(blank=True, max_length=500, null=True)),
- (
- "visibility",
- models.IntegerField(
- choices=[
- (0, "Public"),
- (1, "Unlisted"),
- (2, "Followers"),
- (3, "Mentioned"),
- ],
- default=0,
- ),
- ),
- ("text", models.TextField()),
- ("created", models.DateTimeField(auto_now_add=True)),
- ("updated", models.DateTimeField(auto_now=True)),
- ("deleted", models.DateTimeField(blank=True, null=True)),
- (
- "identity",
- models.ForeignKey(
- on_delete=django.db.models.deletion.PROTECT,
- related_name="statuses",
- to="users.identity",
- ),
- ),
- ],
- ),
- ]
diff --git a/statuses/migrations/__init__.py b/statuses/migrations/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/statuses/migrations/__init__.py
+++ /dev/null
diff --git a/statuses/models/__init__.py b/statuses/models/__init__.py
deleted file mode 100644
index 84098eb..0000000
--- a/statuses/models/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from .status import Status # noqa
diff --git a/statuses/models/status.py b/statuses/models/status.py
deleted file mode 100644
index b12a595..0000000
--- a/statuses/models/status.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import urlman
-from django.db import models
-
-
-class Status(models.Model):
- class StatusVisibility(models.IntegerChoices):
- public = 0
- unlisted = 1
- followers = 2
- mentioned = 3
-
- identity = models.ForeignKey(
- "users.Identity",
- on_delete=models.PROTECT,
- related_name="statuses",
- )
-
- local = models.BooleanField()
- uri = models.CharField(max_length=500, blank=True, null=True)
- visibility = models.IntegerField(
- choices=StatusVisibility.choices,
- default=StatusVisibility.public,
- )
- text = models.TextField()
-
- created = models.DateTimeField(auto_now_add=True)
- updated = models.DateTimeField(auto_now=True)
- deleted = models.DateTimeField(null=True, blank=True)
-
- class Meta:
- verbose_name_plural = "statuses"
-
- @classmethod
- def create_local(cls, identity, text: str):
- return cls.objects.create(
- identity=identity,
- text=text,
- local=True,
- )
-
- class urls(urlman.Urls):
- view = "{self.identity.urls.view}statuses/{self.id}/"
diff --git a/statuses/views/__init__.py b/statuses/views/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/statuses/views/__init__.py
+++ /dev/null
diff --git a/statuses/views/home.py b/statuses/views/home.py
deleted file mode 100644
index b9b98d2..0000000
--- a/statuses/views/home.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from django import forms
-from django.shortcuts import redirect
-from django.utils.decorators import method_decorator
-from django.views.generic import FormView
-
-from core.forms import FormHelper
-from statuses.models import Status
-from users.decorators import identity_required
-
-
-@method_decorator(identity_required, name="dispatch")
-class Home(FormView):
-
- template_name = "statuses/home.html"
-
- class form_class(forms.Form):
- text = forms.CharField()
-
- helper = FormHelper(submit_text="Post")
-
- def get_context_data(self):
- context = super().get_context_data()
- context.update(
- {
- "statuses": self.request.identity.statuses.all()[:100],
- }
- )
- return context
-
- def form_valid(self, form):
- Status.create_local(
- identity=self.request.identity,
- text=form.cleaned_data["text"],
- )
- return redirect(".")