diff --git a/passbook/admin/templates/generic/create.html b/passbook/admin/templates/generic/create.html index d38a9501a..43bce2814 100644 --- a/passbook/admin/templates/generic/create.html +++ b/passbook/admin/templates/generic/create.html @@ -1,11 +1,12 @@ {% extends "generic/form.html" %} +{% load utils %} {% load i18n %} {% block above_form %} -

{% blocktrans with type=type %}Create {{ type }}{% endblocktrans %}

+

{% blocktrans with type=form|form_verbose_name %}Create {{ type }}{% endblocktrans %}

{% endblock %} {% block action %} -{% blocktrans with type=type %}Create {{ type }}{% endblocktrans %} +{% blocktrans with type=form|form_verbose_name %}Create {{ type }}{% endblocktrans %} {% endblock %} diff --git a/passbook/admin/templates/generic/create_inheritance.html b/passbook/admin/templates/generic/create_inheritance.html deleted file mode 100644 index eff352942..000000000 --- a/passbook/admin/templates/generic/create_inheritance.html +++ /dev/null @@ -1,11 +0,0 @@ -{% 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/update.html b/passbook/admin/templates/generic/update.html index 019c1153d..b818ef34a 100644 --- a/passbook/admin/templates/generic/update.html +++ b/passbook/admin/templates/generic/update.html @@ -1,11 +1,12 @@ {% extends "generic/form.html" %} +{% load utils %} {% load i18n %} {% block above_form %} -

{% trans 'Update' %}

+

{% blocktrans with type=form|form_verbose_name %}Update {{ type }}{% endblocktrans %}

{% endblock %} {% block action %} -{% trans 'Update' %} +{% blocktrans with type=form|form_verbose_name %}Update {{ type }}{% endblocktrans %} {% endblock %} diff --git a/passbook/admin/views/factors.py b/passbook/admin/views/factors.py index b43c97090..dd5a689cd 100644 --- a/passbook/admin/views/factors.py +++ b/passbook/admin/views/factors.py @@ -34,7 +34,7 @@ class FactorListView(AdminRequiredMixin, ListView): class FactorCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): """Create new Factor""" - template_name = 'generic/create_inheritance.html' + template_name = 'generic/create.html' success_url = reverse_lazy('passbook_admin:factors') success_message = _('Successfully created Factor') diff --git a/passbook/admin/views/policy.py b/passbook/admin/views/policy.py index 2760ff032..51dc4bd0c 100644 --- a/passbook/admin/views/policy.py +++ b/passbook/admin/views/policy.py @@ -32,7 +32,7 @@ class PolicyListView(AdminRequiredMixin, ListView): class PolicyCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): """Create new Policy""" - template_name = 'generic/create_inheritance.html' + template_name = 'generic/create.html' success_url = reverse_lazy('passbook_admin:policies') success_message = _('Successfully created Policy') diff --git a/passbook/admin/views/providers.py b/passbook/admin/views/providers.py index 7986489b9..77e9f5a81 100644 --- a/passbook/admin/views/providers.py +++ b/passbook/admin/views/providers.py @@ -29,7 +29,7 @@ class ProviderListView(AdminRequiredMixin, ListView): class ProviderCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): """Create new Provider""" - template_name = 'generic/create_inheritance.html' + template_name = 'generic/create.html' success_url = reverse_lazy('passbook_admin:providers') success_message = _('Successfully created Provider') diff --git a/passbook/admin/views/sources.py b/passbook/admin/views/sources.py index 998c9e69b..ea74e1d78 100644 --- a/passbook/admin/views/sources.py +++ b/passbook/admin/views/sources.py @@ -34,7 +34,7 @@ class SourceListView(AdminRequiredMixin, ListView): class SourceCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): """Create new Source""" - template_name = 'generic/create_inheritance.html' + template_name = 'generic/create.html' success_url = reverse_lazy('passbook_admin:sources') success_message = _('Successfully created Source') diff --git a/passbook/hibp_policy/migrations/0003_auto_20190227_1505.py b/passbook/hibp_policy/migrations/0003_auto_20190227_1505.py new file mode 100644 index 000000000..f37bc6a90 --- /dev/null +++ b/passbook/hibp_policy/migrations/0003_auto_20190227_1505.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.7 on 2019-02-27 15:05 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_hibp_policy', '0002_auto_20190225_1912'), + ] + + operations = [ + migrations.AlterModelOptions( + name='haveibeenpwendpolicy', + options={'verbose_name': 'Have I Been Pwned Policy', 'verbose_name_plural': 'Have I Been Pwned Policies'}, + ), + ] diff --git a/passbook/hibp_policy/models.py b/passbook/hibp_policy/models.py index aa400b00e..66da48be4 100644 --- a/passbook/hibp_policy/models.py +++ b/passbook/hibp_policy/models.py @@ -41,5 +41,5 @@ class HaveIBeenPwendPolicy(Policy): class Meta: - verbose_name = _('have i been pwned Policy') - verbose_name_plural = _('have i been pwned Policies') + verbose_name = _('Have I Been Pwned Policy') + verbose_name_plural = _('Have I Been Pwned Policies') diff --git a/passbook/lib/templatetags/utils.py b/passbook/lib/templatetags/utils.py index 1ed90740e..9b14de64e 100644 --- a/passbook/lib/templatetags/utils.py +++ b/passbook/lib/templatetags/utils.py @@ -208,7 +208,14 @@ def gravatar(email, size=None, rating=None): return escape(gravatar_url) + @register.filter def verbose_name(obj): """Return Object's Verbose Name""" return obj._meta.verbose_name + + +@register.filter +def form_verbose_name(obj): + """Return ModelForm's Object's Verbose Name""" + return obj._meta.model._meta.verbose_name