From 8bc950bcf580b936aea644097719493564468695 Mon Sep 17 00:00:00 2001 From: Joseph Kocherhans Date: Wed, 12 Sep 2007 03:13:30 +0000 Subject: [PATCH] newforms-admin: Changed inline model admin back to using verbose_name/verbose_name_plural. We may need both in the templates. git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6107 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/options.py | 13 ++++++------- .../admin/templates/admin/edit_inline_stacked.html | 2 +- .../admin/templates/admin/edit_inline_tabular.html | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index aa4e26cc91..c4476c66dc 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -687,13 +687,18 @@ class InlineModelAdmin(BaseModelAdmin): fk_name = None extra = 3 template = None - label = None + verbose_name = None + verbose_name_plural = None def __init__(self, parent_model, admin_site): self.admin_site = admin_site self.parent_model = parent_model self.opts = self.model._meta super(InlineModelAdmin, self).__init__() + if self.verbose_name is None: + self.verbose_name = self.model._meta.verbose_name + if self.verbose_name_plural is None: + self.verbose_name_plural = self.model._meta.verbose_name_plural def formset_add(self, request): """Returns an InlineFormSet class for use in admin add views.""" @@ -726,15 +731,9 @@ class InlineModelAdmin(BaseModelAdmin): class StackedInline(InlineModelAdmin): template = 'admin/edit_inline_stacked.html' - def get_label(self): - return self.label or self.model._meta.verbose_name - class TabularInline(InlineModelAdmin): template = 'admin/edit_inline_tabular.html' - def get_label(self): - return self.label or self.model._meta.verbose_name_plural - class InlineAdminFormSet(object): """ A wrapper around an inline formset for use in the admin system. diff --git a/django/contrib/admin/templates/admin/edit_inline_stacked.html b/django/contrib/admin/templates/admin/edit_inline_stacked.html index fa5d86bd91..0001ae40cb 100644 --- a/django/contrib/admin/templates/admin/edit_inline_stacked.html +++ b/django/contrib/admin/templates/admin/edit_inline_stacked.html @@ -1,7 +1,7 @@ {{ inline_admin_formset.formset.management_form }} {% for inline_admin_form in inline_admin_formset %}
-

{{ inline_admin_formset.opts.get_label|title }} #{{ forloop.counter }}

+

{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}

{% for bfset in inline_admin_form %} diff --git a/django/contrib/admin/templates/admin/edit_inline_tabular.html b/django/contrib/admin/templates/admin/edit_inline_tabular.html index a4ad7017a4..4d16a6ac43 100644 --- a/django/contrib/admin/templates/admin/edit_inline_tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline_tabular.html @@ -1,7 +1,7 @@ {% load i18n %} {{ inline_admin_formset.formset.management_form }}
-

{{ inline_admin_formset.opts.get_label|capfirst|escape }}

+

{{ inline_admin_formset.opts.verbose_name_plural|capfirst|escape }}

{% if inline_admin_formset.formset.deletable %}{% endif %}
{% trans "Delete" %}?