summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2007-09-12 03:13:30 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2007-09-12 03:13:30 +0000
commit8bc950bcf580b936aea644097719493564468695 (patch)
treec02a9a8d3952093c0f2e0784b05669e70bd171bd
parent76473864b55c33b27651d79efa174c8db8318cbb (diff)
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
-rw-r--r--django/contrib/admin/options.py13
-rw-r--r--django/contrib/admin/templates/admin/edit_inline_stacked.html2
-rw-r--r--django/contrib/admin/templates/admin/edit_inline_tabular.html2
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 %}
<fieldset class="module aligned {{ bfset.fieldset.classes }}">
- <h2>{{ inline_admin_formset.opts.get_label|title }}&nbsp;#{{ forloop.counter }}</h2>
+ <h2>{{ inline_admin_formset.opts.verbose_name|title }}&nbsp;#{{ forloop.counter }}</h2>
{% for bfset in inline_admin_form %}
<!-- fieldsets, headers, and descriptions are commented out until we have decent styles for them -->
<!--<fieldset>-->
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 }}
<fieldset class="module">
- <h2>{{ inline_admin_formset.opts.get_label|capfirst|escape }}</h2>
+ <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst|escape }}</h2>
<table>
<thead><tr>
{% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %}