1
0
mirror of https://github.com/django/django.git synced 2025-07-06 10:49:17 +00:00

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
This commit is contained in:
Joseph Kocherhans 2007-09-12 03:13:30 +00:00
parent 76473864b5
commit 8bc950bcf5
3 changed files with 8 additions and 9 deletions

View File

@ -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.

View File

@ -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>-->

View File

@ -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 %}