Ticket #8903: 10638.diff
File 10638.diff, 1.8 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/helpers.py
145 145 for name, options in self.fieldsets: 146 146 yield InlineFieldset(self.formset, self.form, name, **options) 147 147 148 def has_auto_field(self): 149 return self.form._meta.model._meta.has_auto_field 150 148 151 def field_count(self): 149 152 # tabular.html uses this function for colspan value. 150 num_of_fields = 1 # always has at least one field 153 num_of_fields = 0 154 if self.has_auto_field(): 155 num_of_fields += 1 # account for auto field 151 156 num_of_fields += len(self.fieldsets[0][1]["fields"]) 152 157 if self.formset.can_order: 153 158 num_of_fields += 1 -
django/contrib/admin/templates/admin/edit_inline/tabular.html
26 26 {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %} 27 27 {% if inline_admin_form.show_url %}<a href="../../../r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">{% trans "View on site" %}</a>{% endif %} 28 28 </p>{% endif %} 29 {{ inline_admin_form.pk_field.field }} {{ inline_admin_form.fk_field.field }} 29 {% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %} 30 {{ inline_admin_form.fk_field.field }} 30 31 {% spaceless %} 31 32 {% for fieldset in inline_admin_form %} 32 33 {% for line in fieldset %}