Skip to content

Commit b08d6c3

Browse files
committed
return RedirectBackMixin to school views
1 parent 0c4c73e commit b08d6c3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bullet/bullet_admin/views/education.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from bullet import search
88
from bullet_admin.access import CountryAdminAccess, CountryAdminInAccess
99
from bullet_admin.forms.education import SchoolForm
10+
from bullet_admin.mixins import RedirectBackMixin
1011
from bullet_admin.utils import get_allowed_countries
1112
from bullet_admin.views import GenericForm, GenericList
1213

@@ -69,14 +70,15 @@ def get_edit_url(self, school: School) -> str:
6970
class SchoolUpdateView(
7071
CountryAdminInAccess,
7172
SchoolQuerySetMixin,
73+
RedirectBackMixin,
7274
GenericForm,
7375
UpdateView,
7476
):
7577
form_class = SchoolForm
7678
template_name = "bullet_admin/education/school_form.html"
7779
form_title = "Edit school"
7880
require_unlocked_competition = False
79-
success_url = reverse_lazy("badmin:school_list")
81+
default_success_url = reverse_lazy("badmin:school_list")
8082

8183
def get_permission_country(self):
8284
return self.get_object().country
@@ -93,12 +95,12 @@ def form_valid(self, form):
9395

9496

9597
class SchoolCreateView(
96-
CountryAdminAccess, SchoolQuerySetMixin, GenericForm, CreateView
98+
CountryAdminAccess, SchoolQuerySetMixin, RedirectBackMixin, GenericForm, CreateView
9799
):
98100
require_unlocked_competition = False
99101
form_class = SchoolForm
100102
form_title = "New school"
101-
success_url = reverse_lazy("badmin:school_list")
103+
default_success_url = reverse_lazy("badmin:school_list")
102104

103105
def form_valid(self, form):
104106
school: School = form.save(commit=False)

0 commit comments

Comments
 (0)