Fixed #11042 -- Corrected admin inlines for inherited models. Thanks to jsmullyan for the report, and mir for helpful triage work. Patch includes regression test for #8093, and a commented out test for #10992.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10725 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2009-05-09 11:40:13 +00:00
parent c40f715257
commit 2c2871b7c3
3 changed files with 295 additions and 5 deletions

View file

@ -146,7 +146,13 @@ class InlineAdminForm(AdminForm):
yield InlineFieldset(self.formset, self.form, name, **options)
def has_auto_field(self):
return self.form._meta.model._meta.has_auto_field
if self.form._meta.model._meta.has_auto_field:
return True
# Also search any parents for an auto field.
for parent in self.form._meta.model._meta.get_parent_list():
if parent._meta.has_auto_field:
return True
return False
def field_count(self):
# tabular.html uses this function for colspan value.