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:
parent
76473864b5
commit
8bc950bcf5
@ -687,13 +687,18 @@ class InlineModelAdmin(BaseModelAdmin):
|
|||||||
fk_name = None
|
fk_name = None
|
||||||
extra = 3
|
extra = 3
|
||||||
template = None
|
template = None
|
||||||
label = None
|
verbose_name = None
|
||||||
|
verbose_name_plural = None
|
||||||
|
|
||||||
def __init__(self, parent_model, admin_site):
|
def __init__(self, parent_model, admin_site):
|
||||||
self.admin_site = admin_site
|
self.admin_site = admin_site
|
||||||
self.parent_model = parent_model
|
self.parent_model = parent_model
|
||||||
self.opts = self.model._meta
|
self.opts = self.model._meta
|
||||||
super(InlineModelAdmin, self).__init__()
|
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):
|
def formset_add(self, request):
|
||||||
"""Returns an InlineFormSet class for use in admin add views."""
|
"""Returns an InlineFormSet class for use in admin add views."""
|
||||||
@ -726,15 +731,9 @@ class InlineModelAdmin(BaseModelAdmin):
|
|||||||
class StackedInline(InlineModelAdmin):
|
class StackedInline(InlineModelAdmin):
|
||||||
template = 'admin/edit_inline_stacked.html'
|
template = 'admin/edit_inline_stacked.html'
|
||||||
|
|
||||||
def get_label(self):
|
|
||||||
return self.label or self.model._meta.verbose_name
|
|
||||||
|
|
||||||
class TabularInline(InlineModelAdmin):
|
class TabularInline(InlineModelAdmin):
|
||||||
template = 'admin/edit_inline_tabular.html'
|
template = 'admin/edit_inline_tabular.html'
|
||||||
|
|
||||||
def get_label(self):
|
|
||||||
return self.label or self.model._meta.verbose_name_plural
|
|
||||||
|
|
||||||
class InlineAdminFormSet(object):
|
class InlineAdminFormSet(object):
|
||||||
"""
|
"""
|
||||||
A wrapper around an inline formset for use in the admin system.
|
A wrapper around an inline formset for use in the admin system.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{{ inline_admin_formset.formset.management_form }}
|
{{ inline_admin_formset.formset.management_form }}
|
||||||
{% for inline_admin_form in inline_admin_formset %}
|
{% for inline_admin_form in inline_admin_formset %}
|
||||||
<fieldset class="module aligned {{ bfset.fieldset.classes }}">
|
<fieldset class="module aligned {{ bfset.fieldset.classes }}">
|
||||||
<h2>{{ inline_admin_formset.opts.get_label|title }} #{{ forloop.counter }}</h2>
|
<h2>{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}</h2>
|
||||||
{% for bfset in inline_admin_form %}
|
{% for bfset in inline_admin_form %}
|
||||||
<!-- fieldsets, headers, and descriptions are commented out until we have decent styles for them -->
|
<!-- fieldsets, headers, and descriptions are commented out until we have decent styles for them -->
|
||||||
<!--<fieldset>-->
|
<!--<fieldset>-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{{ inline_admin_formset.formset.management_form }}
|
{{ inline_admin_formset.formset.management_form }}
|
||||||
<fieldset class="module">
|
<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>
|
<table>
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
{% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %}
|
{% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user