From bb8f589da7d72a6a90c193eb0e1ac3672cc4e76f Mon Sep 17 00:00:00 2001 From: mj2p <41858365+mj2p@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:15:29 +0100 Subject: [PATCH] Bugfix admin redirect fixes (#587) --- templates/admin/announcement_edit.html | 2 +- templates/admin/announcements.html | 4 ++-- templates/admin/federation.html | 4 ++-- templates/admin/federation_edit.html | 2 +- templates/admin/hashtag_edit.html | 2 +- templates/admin/hashtags.html | 4 ++-- templates/admin/identities.html | 4 ++-- templates/admin/identity_edit.html | 2 +- templates/admin/invite_view.html | 2 +- templates/admin/invites.html | 4 ++-- templates/admin/report_view.html | 2 +- templates/admin/reports.html | 4 ++-- templates/admin/user_edit.html | 2 +- templates/admin/users.html | 4 ++-- users/views/admin/announcements.py | 6 +++++- users/views/admin/federation.py | 1 + users/views/admin/hashtags.py | 1 + users/views/admin/identities.py | 1 + users/views/admin/invites.py | 1 + users/views/admin/reports.py | 1 + users/views/admin/users.py | 1 + 21 files changed, 32 insertions(+), 22 deletions(-) diff --git a/templates/admin/announcement_edit.html b/templates/admin/announcement_edit.html index 7d60b9a..fead07e 100644 --- a/templates/admin/announcement_edit.html +++ b/templates/admin/announcement_edit.html @@ -16,7 +16,7 @@ {% include "forms/_field.html" with field=form.end %}
- Back + Back Delete
diff --git a/templates/admin/announcements.html b/templates/admin/announcements.html index 11dc695..47d1d52 100644 --- a/templates/admin/announcements.html +++ b/templates/admin/announcements.html @@ -10,11 +10,11 @@ {% for announcement in page_obj %} - + - + {{ announcement.html|truncatewords_html:"10" }} {% if announcement.service_announcement %}{{ domain.service_domain }}{% endif %} diff --git a/templates/admin/federation.html b/templates/admin/federation.html index 44ac896..0e687d9 100644 --- a/templates/admin/federation.html +++ b/templates/admin/federation.html @@ -12,11 +12,11 @@ {% for domain in page_obj %} - + - + {{ domain.domain }} {{ domain.software }} diff --git a/templates/admin/federation_edit.html b/templates/admin/federation_edit.html index c32d1cc..a6fc41a 100644 --- a/templates/admin/federation_edit.html +++ b/templates/admin/federation_edit.html @@ -15,7 +15,7 @@ {% include "forms/_field.html" with field=form.notes %}
- Back + Back Delete
diff --git a/templates/admin/hashtag_edit.html b/templates/admin/hashtag_edit.html index 1be912f..a7ef983 100644 --- a/templates/admin/hashtag_edit.html +++ b/templates/admin/hashtag_edit.html @@ -38,7 +38,7 @@
- Back + Back View Posts
diff --git a/templates/admin/hashtags.html b/templates/admin/hashtags.html index 910e527..6101d38 100644 --- a/templates/admin/hashtags.html +++ b/templates/admin/hashtags.html @@ -7,11 +7,11 @@ {% for hashtag in page_obj %} - + - + {{ hashtag.display_name }} {% if hashtag.public %}Public{% elif hashtag.public is None %}Unreviewed{% else %}Private{% endif %} diff --git a/templates/admin/identities.html b/templates/admin/identities.html index 62c87e3..15bbea2 100644 --- a/templates/admin/identities.html +++ b/templates/admin/identities.html @@ -22,7 +22,7 @@ {% for identity in page_obj %} - + - + {{ identity.html_name_or_handle }} @{{ identity.handle }} diff --git a/templates/admin/identity_edit.html b/templates/admin/identity_edit.html index 2f9fa28..28000c6 100644 --- a/templates/admin/identity_edit.html +++ b/templates/admin/identity_edit.html @@ -115,7 +115,7 @@ {% endif %}
- Back + Back View Profile
diff --git a/templates/admin/invite_view.html b/templates/admin/invite_view.html index b5ded54..26deb7d 100644 --- a/templates/admin/invite_view.html +++ b/templates/admin/invite_view.html @@ -13,7 +13,7 @@ {% include "forms/_field.html" with field=form.notes %}
- Back + Back
diff --git a/templates/admin/invites.html b/templates/admin/invites.html index fcfbe74..bfd21fc 100644 --- a/templates/admin/invites.html +++ b/templates/admin/invites.html @@ -12,11 +12,11 @@ {% for invite in page_obj %} - + - + {{ invite.token }} {% if invite.note %} diff --git a/templates/admin/report_view.html b/templates/admin/report_view.html index 71c24d1..9d93fb3 100644 --- a/templates/admin/report_view.html +++ b/templates/admin/report_view.html @@ -77,7 +77,7 @@
- Back + Back View Profile Identity Admin diff --git a/templates/admin/reports.html b/templates/admin/reports.html index b96a2da..d28b8d5 100644 --- a/templates/admin/reports.html +++ b/templates/admin/reports.html @@ -15,11 +15,11 @@ {% for report in page_obj %} - + Avatar for {{ report.subject_identity.name_or_handle }} - + {{ report.subject_identity.html_name_or_handle }} {% if report.subject_post %} diff --git a/templates/admin/user_edit.html b/templates/admin/user_edit.html index 3f43022..cac5f2c 100644 --- a/templates/admin/user_edit.html +++ b/templates/admin/user_edit.html @@ -29,7 +29,7 @@

Created:

- Back + Back
diff --git a/templates/admin/users.html b/templates/admin/users.html index da65c79..7107832 100644 --- a/templates/admin/users.html +++ b/templates/admin/users.html @@ -12,11 +12,11 @@ {% for user in page_obj %} - + - + {{ user.email }} {% if user.admin %}Admin{% elif user.moderator %}Moderator{% endif %} diff --git a/users/views/admin/announcements.py b/users/views/admin/announcements.py index 5988f23..972654a 100644 --- a/users/views/admin/announcements.py +++ b/users/views/admin/announcements.py @@ -49,7 +49,11 @@ class AnnouncementEdit(UpdateView): model = Announcement template_name = "admin/announcement_edit.html" extra_context = {"section": "announcements"} - success_url = Announcement.urls.admin_root + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context["page"] = self.request.GET.get("page") + return context class form_class(AnnouncementCreate.form_class): pass diff --git a/users/views/admin/federation.py b/users/views/admin/federation.py index 345df2e..a480a0e 100644 --- a/users/views/admin/federation.py +++ b/users/views/admin/federation.py @@ -64,6 +64,7 @@ class FederationEdit(FormView): def get_context_data(self, *args, **kwargs): context = super().get_context_data(*args, **kwargs) context["domain"] = self.domain + context["page"] = self.request.GET.get("page") return context def form_valid(self, form): diff --git a/users/views/admin/hashtags.py b/users/views/admin/hashtags.py index b082ee4..d9a9aaa 100644 --- a/users/views/admin/hashtags.py +++ b/users/views/admin/hashtags.py @@ -64,6 +64,7 @@ class HashtagEdit(FormView): def get_context_data(self, *args, **kwargs): context = super().get_context_data(*args, **kwargs) context["hashtag"] = self.hashtag + context["page"] = self.request.GET.get("page") return context def form_valid(self, form): diff --git a/users/views/admin/identities.py b/users/views/admin/identities.py index 9292ab9..98fca09 100644 --- a/users/views/admin/identities.py +++ b/users/views/admin/identities.py @@ -90,4 +90,5 @@ class IdentityEdit(FormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["identity"] = self.identity + context["page"] = self.request.GET.get("page") return context diff --git a/users/views/admin/invites.py b/users/views/admin/invites.py index db9e8bb..6baace7 100644 --- a/users/views/admin/invites.py +++ b/users/views/admin/invites.py @@ -106,4 +106,5 @@ class InviteView(FormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["invite"] = self.invite + context["page"] = self.request.GET.get("page") return context diff --git a/users/views/admin/reports.py b/users/views/admin/reports.py index d666eb9..1cc59a3 100644 --- a/users/views/admin/reports.py +++ b/users/views/admin/reports.py @@ -77,4 +77,5 @@ class ReportView(FormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["report"] = self.report + context["page"] = self.request.GET.get("page") return context diff --git a/users/views/admin/users.py b/users/views/admin/users.py index 5921de2..5c67947 100644 --- a/users/views/admin/users.py +++ b/users/views/admin/users.py @@ -81,4 +81,5 @@ class UserEdit(FormView): context = super().get_context_data(**kwargs) context["editing_user"] = self.user context["same_user"] = self.user == self.request.user + context["page"] = self.request.GET.get("page") return context