diff --git a/passbook/admin/templates/generic/create_inheritance.html b/passbook/admin/templates/generic/create_inheritance.html new file mode 100644 index 000000000..eff352942 --- /dev/null +++ b/passbook/admin/templates/generic/create_inheritance.html @@ -0,0 +1,11 @@ +{% extends "generic/create.html" %} + +{% load i18n %} + +{% block title %} +{% blocktrans with type=request.GET.type %}Create {{ type }}{% endblocktrans %} +{% endblock %} + +{% block above_form %} +

{% blocktrans with type=request.GET.type %}Create {{ type }}{% endblocktrans %}

+{% endblock %} \ No newline at end of file diff --git a/passbook/admin/templates/generic/delete.html b/passbook/admin/templates/generic/delete.html new file mode 100644 index 000000000..948ac9817 --- /dev/null +++ b/passbook/admin/templates/generic/delete.html @@ -0,0 +1,20 @@ +{% extends "administration/base.html" %} + +{% load i18n %} +{% load utils %} + +{% block content %} +
+ {% block above_form %} +

{% trans 'Delete' %}

+ {% endblock %} +
+
+ {% csrf_token %} +

Are you sure you want to delete "{{ object }}"?

+ {% trans 'Back' %} + +
+
+
+{% endblock %} \ No newline at end of file diff --git a/passbook/admin/templates/generic/form.html b/passbook/admin/templates/generic/form.html index 541ab2466..9372c2452 100644 --- a/passbook/admin/templates/generic/form.html +++ b/passbook/admin/templates/generic/form.html @@ -1,7 +1,7 @@ {% extends "administration/base.html" %} -{% load crispy_forms_tags %} {% load i18n %} +{% load utils %} {% block content %}
@@ -10,6 +10,7 @@
{% include 'blocks/form.html' with form=form %} + {% trans "Cancel" %}
diff --git a/passbook/admin/views/rules.py b/passbook/admin/views/rules.py index e8e0c169a..aa4917389 100644 --- a/passbook/admin/views/rules.py +++ b/passbook/admin/views/rules.py @@ -28,7 +28,7 @@ class RuleListView(AdminRequiredMixin, ListView): class RuleCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): """Create new Rule""" - template_name = 'administration/rule/create.html' + template_name = 'generic/create_inheritance.html' success_url = reverse_lazy('passbook_admin:rules') success_message = _('Successfully created Rule') @@ -55,18 +55,16 @@ class RuleUpdateView(SuccessMessageMixin, AdminRequiredMixin, UpdateView): return form_class def get_object(self, queryset=None): - obj = Rule.objects.get(pk=self.kwargs.get('pk')) - return obj.cast() + return Rule.objects.filter(pk=self.kwargs.get('pk')).select_subclasses().first() class RuleDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView): """Delete rule""" model = Rule - + template_name = 'generic/delete.html' success_url = reverse_lazy('passbook_admin:rules') success_message = _('Successfully updated Rule') def get_object(self, queryset=None): - obj = Rule.objects.get(pk=self.kwargs.get('pk')) - return obj.cast() + return Rule.objects.filter(pk=self.kwargs.get('pk')).select_subclasses().first() diff --git a/passbook/admin/views/sources.py b/passbook/admin/views/sources.py index f40b3c237..777289ff1 100644 --- a/passbook/admin/views/sources.py +++ b/passbook/admin/views/sources.py @@ -28,7 +28,7 @@ class SourceListView(AdminRequiredMixin, ListView): class SourceCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): """Create new Source""" - template_name = 'administration/source/create.html' + template_name = 'generic/create_inheritance.html' success_url = reverse_lazy('passbook_admin:sources') success_message = _('Successfully created Source')