diff --git a/nummi/main/templates/main/form/base.html b/nummi/main/templates/main/form/base.html index e0b5b7d..edb30f4 100644 --- a/nummi/main/templates/main/form/base.html +++ b/nummi/main/templates/main/form/base.html @@ -22,25 +22,17 @@ {% endfor %} - {% block buttons %} - {% if form.instance.adding %} - - - - - - - {% endif %} - - + + + {% block buttons %} {% if not form.instance.adding %} {% translate "Delete" %} {% endif %} - - - {% endblock %} + {% endblock %} + + {% endblock %} diff --git a/nummi/main/templates/main/form/login.html b/nummi/main/templates/main/form/login.html index 4e344c7..841e941 100644 --- a/nummi/main/templates/main/form/login.html +++ b/nummi/main/templates/main/form/login.html @@ -1,11 +1,7 @@ {% extends "main/form/base.html" %} {% load i18n %} {% block buttons %} - - - - - - - + + + {% endblock %} diff --git a/nummi/main/templates/main/form/search.html b/nummi/main/templates/main/form/search.html index ffb1775..58d3a2f 100644 --- a/nummi/main/templates/main/form/search.html +++ b/nummi/main/templates/main/form/search.html @@ -1,10 +1,6 @@ {% extends "main/form/base.html" %} {% load i18n %} {% block buttons %} - - - - - - + + {% endblock %} diff --git a/nummi/main/views.py b/nummi/main/views.py index 3c465fc..27bfd0f 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -71,12 +71,12 @@ class UserFormMixin: class NummiCreateView(UserMixin, UserFormMixin, CreateView): + def get_success_url(self): + return self.object.get_create_url() + def form_valid(self, form): form.instance.user = self.request.user - _res = super().form_valid(form) - if form.data["addmore"]: - return HttpResponseRedirect(self.object.get_create_url()) - return _res + return super().form_valid(form) class NummiUpdateView(UserMixin, UserFormMixin, UpdateView):