From 21d98c5ebdf7063aca8666255b31673e6af595c8 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 30 Apr 2010 15:24:07 +0000 Subject: [PATCH] Fixed #13443 -- Added required CSS class to the column headings on admin TabularInline formsets. Thanks to deschler for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@13058 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/helpers.py | 12 ++++++++---- .../admin/templates/admin/edit_inline/tabular.html | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index 41c2c54145..6bcaf80248 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -218,11 +218,15 @@ class InlineAdminFormSet(object): if fk and fk.name == field: continue if field in self.readonly_fields: - label = label_for_field(field, self.opts.model, self.model_admin) - yield (False, label) + yield { + 'label': label_for_field(field, self.opts.model, self.model_admin), + 'widget': { + 'is_hidden': False + }, + 'required': False + } else: - field = self.formset.form.base_fields[field] - yield (field.widget.is_hidden, field.label) + yield self.formset.form.base_fields[field] def _media(self): media = self.opts.media + self.formset.media diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index c68cc79d60..11002ceb87 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -7,9 +7,9 @@ {{ inline_admin_formset.formset.non_form_errors }} - {% for is_hidden, label in inline_admin_formset.fields %} - {% if not is_hidden %} - + {% for field in inline_admin_formset.fields %} + {% if not field.widget.is_hidden %} + {{ field.label|capfirst }} {% endif %} {% endfor %} {% if inline_admin_formset.formset.can_delete %}{% endif %}
{{ label|capfirst }}{% trans "Delete?" %}