1
0
mirror of https://github.com/django/django.git synced 2024-12-25 10:35:48 +00:00

Fixed #12628 - Don't ignore read-only fields in GenericInlineModelAdmin during save. Thanks, Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12367 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2010-02-01 14:13:21 +00:00
parent 267346678d
commit be90eadfb9

View File

@ -379,6 +379,12 @@ class GenericInlineModelAdmin(InlineModelAdmin):
fields = flatten_fieldsets(self.declared_fieldsets)
else:
fields = None
if self.exclude is None:
exclude = []
else:
exclude = list(self.exclude)
exclude.extend(self.get_readonly_fields(request, obj))
exclude = exclude or None
defaults = {
"ct_field": self.ct_field,
"fk_field": self.ct_fk_field,
@ -390,7 +396,7 @@ class GenericInlineModelAdmin(InlineModelAdmin):
"can_order": False,
"fields": fields,
"max_num": self.max_num,
"exclude": self.exclude
"exclude": exclude
}
return generic_inlineformset_factory(self.model, **defaults)