Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #13443 -- Added required CSS class to the column headings on ad…

…min TabularInline formsets. Thanks to deschler for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13058 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 21d98c5ebdf7063aca8666255b31673e6af595c8 1 parent 7fa7bed
Russell Keith-Magee authored April 30, 2010
12  django/contrib/admin/helpers.py
@@ -218,11 +218,15 @@ def fields(self):
218 218
             if fk and fk.name == field:
219 219
                 continue
220 220
             if field in self.readonly_fields:
221  
-                label = label_for_field(field, self.opts.model, self.model_admin)
222  
-                yield (False, label)
  221
+                yield {
  222
+                    'label': label_for_field(field, self.opts.model, self.model_admin),
  223
+                    'widget': {
  224
+                        'is_hidden': False
  225
+                    },
  226
+                    'required': False
  227
+                }
223 228
             else:
224  
-                field = self.formset.form.base_fields[field]
225  
-                yield (field.widget.is_hidden, field.label)
  229
+                yield self.formset.form.base_fields[field]
226 230
 
227 231
     def _media(self):
228 232
         media = self.opts.media + self.formset.media
6  django/contrib/admin/templates/admin/edit_inline/tabular.html
@@ -7,9 +7,9 @@
7 7
    {{ inline_admin_formset.formset.non_form_errors }}
8 8
    <table>
9 9
      <thead><tr>
10  
-     {% for is_hidden, label in inline_admin_formset.fields %}
11  
-       {% if not is_hidden %}
12  
-         <th {% if forloop.first %}colspan="2"{% endif %}>{{ label|capfirst }}</th>
  10
+     {% for field in inline_admin_formset.fields %}
  11
+       {% if not field.widget.is_hidden %}
  12
+         <th{% if forloop.first %} colspan="2"{% endif %}{% if field.required %} class="required"{% endif %}>{{ field.label|capfirst }}</th>
13 13
        {% endif %}
14 14
      {% endfor %}
15 15
      {% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %}

0 notes on commit 21d98c5

Please sign in to comment.
Something went wrong with that request. Please try again.