diff --git a/templates/admin/federation_edit.html b/templates/admin/federation_edit.html
index a711f74..e4d7226 100644
--- a/templates/admin/federation_edit.html
+++ b/templates/admin/federation_edit.html
@@ -10,6 +10,10 @@
{% include "forms/_field.html" with field=form.blocked %}
+
Back
Delete
diff --git a/users/migrations/0014_domain_notes.py b/users/migrations/0014_domain_notes.py
new file mode 100644
index 0000000..0e2a6ce
--- /dev/null
+++ b/users/migrations/0014_domain_notes.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.1.7 on 2023-03-06 21:26
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("users", "0013_stator_indexes"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="domain",
+ name="notes",
+ field=models.TextField(blank=True, null=True),
+ ),
+ ]
diff --git a/users/models/domain.py b/users/models/domain.py
index ecf6347..f4de1e4 100644
--- a/users/models/domain.py
+++ b/users/models/domain.py
@@ -92,6 +92,9 @@ class Domain(StatorModel):
# This should be display domains ONLY
users = models.ManyToManyField("users.User", related_name="domains", blank=True)
+ # Free-form notes field for admins
+ notes = models.TextField(blank=True, null=True)
+
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
diff --git a/users/views/admin/domains.py b/users/views/admin/domains.py
index 637c87b..36e5454 100644
--- a/users/views/admin/domains.py
+++ b/users/views/admin/domains.py
@@ -74,6 +74,15 @@ class DomainCreate(FormView):
widget=forms.Textarea,
required=False,
)
+ notes = forms.CharField(
+ label="Notes",
+ widget=forms.Textarea(
+ attrs={
+ "rows": 3,
+ },
+ ),
+ required=False,
+ )
def clean_domain(self):
if Domain.objects.filter(
@@ -131,6 +140,7 @@ class DomainCreate(FormView):
domain = Domain.objects.create(
domain=form.cleaned_data["domain"],
service_domain=form.cleaned_data["service_domain"] or None,
+ notes=form.cleaned_data["notes"] or None,
public=form.cleaned_data["public"],
default=form.cleaned_data["default"],
local=True,
@@ -173,6 +183,7 @@ class DomainEdit(FormView):
def form_valid(self, form):
self.domain.public = form.cleaned_data["public"]
self.domain.default = form.cleaned_data["default"]
+ self.domain.notes = form.cleaned_data["notes"] or None
self.domain.save()
self.domain.users.set(form.cleaned_data["users"])
if self.domain.default:
@@ -183,6 +194,7 @@ class DomainEdit(FormView):
return {
"domain": self.domain.domain,
"service_domain": self.domain.service_domain,
+ "notes": self.domain.notes,
"public": self.domain.public,
"default": self.domain.default,
"users": "\n".join(sorted(user.email for user in self.domain.users.all())),
diff --git a/users/views/admin/federation.py b/users/views/admin/federation.py
index 0611b9e..345df2e 100644
--- a/users/views/admin/federation.py
+++ b/users/views/admin/federation.py
@@ -45,6 +45,15 @@ class FederationEdit(FormView):
widget=forms.Select(choices=[(True, "Blocked"), (False, "Not Blocked")]),
required=False,
)
+ notes = forms.CharField(
+ label="Notes",
+ widget=forms.Textarea(
+ attrs={
+ "rows": 3,
+ },
+ ),
+ required=False,
+ )
def dispatch(self, request, domain):
self.domain = get_object_or_404(
@@ -59,10 +68,12 @@ class FederationEdit(FormView):
def form_valid(self, form):
self.domain.blocked = form.cleaned_data["blocked"]
+ self.domain.notes = form.cleaned_data["notes"] or None
self.domain.save()
return redirect(Domain.urls.root_federation)
def get_initial(self):
return {
"blocked": self.domain.blocked,
+ "notes": self.domain.notes,
}