Updates references to templates

This commit is contained in:
Mouse Reeve 2021-09-28 12:39:52 -07:00
parent 1c262a1a64
commit 9c9adfc6f0
10 changed files with 46 additions and 20 deletions

View File

@ -41,7 +41,9 @@ class Announcements(View):
"form": forms.AnnouncementForm(), "form": forms.AnnouncementForm(),
"sort": sort, "sort": sort,
} }
return TemplateResponse(request, "settings/announcements.html", data) return TemplateResponse(
request, "settings/announcements/announcements.html", data
)
def post(self, request): def post(self, request):
"""edit the site settings""" """edit the site settings"""
@ -56,7 +58,9 @@ class Announcements(View):
).get_page(request.GET.get("page")), ).get_page(request.GET.get("page")),
"form": form, "form": form,
} }
return TemplateResponse(request, "settings/announcements.html", data) return TemplateResponse(
request, "settings/announcements/announcements.html", data
)
@method_decorator(login_required, name="dispatch") @method_decorator(login_required, name="dispatch")
@ -74,7 +78,9 @@ class Announcement(View):
"announcement": announcement, "announcement": announcement,
"form": forms.AnnouncementForm(instance=announcement), "form": forms.AnnouncementForm(instance=announcement),
} }
return TemplateResponse(request, "settings/announcement.html", data) return TemplateResponse(
request, "settings/announcements/announcement.html", data
)
def post(self, request, announcement_id): def post(self, request, announcement_id):
"""edit announcement""" """edit announcement"""
@ -87,7 +93,9 @@ class Announcement(View):
"announcement": announcement, "announcement": announcement,
"form": form, "form": form,
} }
return TemplateResponse(request, "settings/announcement.html", data) return TemplateResponse(
request, "settings/announcements/announcement.html", data
)
@login_required @login_required

View File

@ -85,4 +85,4 @@ class Dashboard(View):
"user_stats": user_stats, "user_stats": user_stats,
"status_stats": status_stats, "status_stats": status_stats,
} }
return TemplateResponse(request, "settings/dashboard.html", data) return TemplateResponse(request, "settings/dashboard/dashboard.html", data)

View File

@ -22,7 +22,9 @@ class EmailBlocklist(View):
"domains": models.EmailBlocklist.objects.order_by("-created_date").all(), "domains": models.EmailBlocklist.objects.order_by("-created_date").all(),
"form": forms.EmailBlocklistForm(), "form": forms.EmailBlocklistForm(),
} }
return TemplateResponse(request, "settings/email_blocklist.html", data) return TemplateResponse(
request, "settings/email_blocklist/email_blocklist.html", data
)
def post(self, request, domain_id=None): def post(self, request, domain_id=None):
"""create a new domain block""" """create a new domain block"""
@ -35,11 +37,15 @@ class EmailBlocklist(View):
"form": form, "form": form,
} }
if not form.is_valid(): if not form.is_valid():
return TemplateResponse(request, "settings/email_blocklist.html", data) return TemplateResponse(
request, "settings/email_blocklist/email_blocklist.html", data
)
form.save() form.save()
data["form"] = forms.EmailBlocklistForm() data["form"] = forms.EmailBlocklistForm()
return TemplateResponse(request, "settings/email_blocklist.html", data) return TemplateResponse(
request, "settings/email_blocklist/email_blocklist.html", data
)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def delete(self, request, domain_id): def delete(self, request, domain_id):

View File

@ -44,7 +44,7 @@ class Federation(View):
"sort": sort, "sort": sort,
"form": forms.ServerForm(), "form": forms.ServerForm(),
} }
return TemplateResponse(request, "settings/federation.html", data) return TemplateResponse(request, "settings/federation/instance_list.html", data)
class AddFederatedServer(View): class AddFederatedServer(View):
@ -53,14 +53,16 @@ class AddFederatedServer(View):
def get(self, request): def get(self, request):
"""add server form""" """add server form"""
data = {"form": forms.ServerForm()} data = {"form": forms.ServerForm()}
return TemplateResponse(request, "settings/edit_server.html", data) return TemplateResponse(request, "settings/federation/edit_instance.html", data)
def post(self, request): def post(self, request):
"""add a server from the admin panel""" """add a server from the admin panel"""
form = forms.ServerForm(request.POST) form = forms.ServerForm(request.POST)
if not form.is_valid(): if not form.is_valid():
data = {"form": form} data = {"form": form}
return TemplateResponse(request, "settings/edit_server.html", data) return TemplateResponse(
request, "settings/federation/edit_instance.html", data
)
server = form.save() server = form.save()
return redirect("settings-federated-server", server.id) return redirect("settings-federated-server", server.id)
@ -75,7 +77,7 @@ class ImportServerBlocklist(View):
def get(self, request): def get(self, request):
"""add server form""" """add server form"""
return TemplateResponse(request, "settings/server_blocklist.html") return TemplateResponse(request, "settings/federation/instance_blocklist.html")
def post(self, request): def post(self, request):
"""add a server from the admin panel""" """add a server from the admin panel"""
@ -98,7 +100,9 @@ class ImportServerBlocklist(View):
server.block() server.block()
success_count += 1 success_count += 1
data = {"failed": failed, "succeeded": success_count} data = {"failed": failed, "succeeded": success_count}
return TemplateResponse(request, "settings/server_blocklist.html", data) return TemplateResponse(
request, "settings/federation/instance_blocklist.html", data
)
@method_decorator(login_required, name="dispatch") @method_decorator(login_required, name="dispatch")
@ -123,7 +127,7 @@ class FederatedServer(View):
user_subject__in=users.all() user_subject__in=users.all()
), ),
} }
return TemplateResponse(request, "settings/federated_server.html", data) return TemplateResponse(request, "settings/federation/instance.html", data)
def post(self, request, server): # pylint: disable=unused-argument def post(self, request, server): # pylint: disable=unused-argument
"""update note""" """update note"""

View File

@ -45,7 +45,7 @@ class ManageInvites(View):
), ),
"form": forms.CreateInviteForm(), "form": forms.CreateInviteForm(),
} }
return TemplateResponse(request, "settings/manage_invites.html", data) return TemplateResponse(request, "settings/invites/manage_invites.html", data)
def post(self, request): def post(self, request):
"""creates an invite database entry""" """creates an invite database entry"""
@ -64,7 +64,7 @@ class ManageInvites(View):
PAGE_LENGTH, PAGE_LENGTH,
) )
data = {"invites": paginated.page(1), "form": form} data = {"invites": paginated.page(1), "form": form}
return TemplateResponse(request, "settings/manage_invites.html", data) return TemplateResponse(request, "settings/invites/manage_invites.html", data)
class Invite(View): class Invite(View):
@ -135,7 +135,9 @@ class ManageInviteRequests(View):
), ),
"sort": sort, "sort": sort,
} }
return TemplateResponse(request, "settings/manage_invite_requests.html", data) return TemplateResponse(
request, "settings/invites/manage_invite_requests.html", data
)
def post(self, request): def post(self, request):
"""send out an invite""" """send out an invite"""

View File

@ -22,7 +22,9 @@ class IPBlocklist(View):
"addresses": models.IPBlocklist.objects.all(), "addresses": models.IPBlocklist.objects.all(),
"form": forms.IPBlocklistForm(), "form": forms.IPBlocklistForm(),
} }
return TemplateResponse(request, "settings/ip_blocklist.html", data) return TemplateResponse(
request, "settings/ip_blocklist/ip_blocklist.html", data
)
def post(self, request, block_id=None): def post(self, request, block_id=None):
"""create a new ip address block""" """create a new ip address block"""
@ -35,11 +37,15 @@ class IPBlocklist(View):
"form": form, "form": form,
} }
if not form.is_valid(): if not form.is_valid():
return TemplateResponse(request, "settings/ip_blocklist.html", data) return TemplateResponse(
request, "settings/ip_blocklist/ip_blocklist.html", data
)
form.save() form.save()
data["form"] = forms.IPBlocklistForm() data["form"] = forms.IPBlocklistForm()
return TemplateResponse(request, "settings/ip_blocklist.html", data) return TemplateResponse(
request, "settings/ip_blocklist/ip_blocklist.html", data
)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def delete(self, request, domain_id): def delete(self, request, domain_id):