1
0
mirror of https://github.com/django/django.git synced 2024-12-25 18:46:22 +00:00

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
This commit is contained in:
Russell Keith-Magee 2010-04-30 15:24:07 +00:00
parent 7fa7bed911
commit 21d98c5ebd
2 changed files with 11 additions and 7 deletions

View File

@ -218,11 +218,15 @@ class InlineAdminFormSet(object):
if fk and fk.name == field: if fk and fk.name == field:
continue continue
if field in self.readonly_fields: if field in self.readonly_fields:
label = label_for_field(field, self.opts.model, self.model_admin) yield {
yield (False, label) 'label': label_for_field(field, self.opts.model, self.model_admin),
'widget': {
'is_hidden': False
},
'required': False
}
else: else:
field = self.formset.form.base_fields[field] yield self.formset.form.base_fields[field]
yield (field.widget.is_hidden, field.label)
def _media(self): def _media(self):
media = self.opts.media + self.formset.media media = self.opts.media + self.formset.media

View File

@ -7,9 +7,9 @@
{{ inline_admin_formset.formset.non_form_errors }} {{ inline_admin_formset.formset.non_form_errors }}
<table> <table>
<thead><tr> <thead><tr>
{% for is_hidden, label in inline_admin_formset.fields %} {% for field in inline_admin_formset.fields %}
{% if not is_hidden %} {% if not field.widget.is_hidden %}
<th {% if forloop.first %}colspan="2"{% endif %}>{{ label|capfirst }}</th> <th{% if forloop.first %} colspan="2"{% endif %}{% if field.required %} class="required"{% endif %}>{{ field.label|capfirst }}</th>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %} {% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %}