Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #12628 - Don't ignore read-only fields in GenericInlineModelAdm…

…in during save. Thanks, Alex Gaynor.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12367 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit be90eadfb98b7f7115a5e19e141e522aefd3f69f 1 parent 2673466
@jezdez jezdez authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/contrib/contenttypes/generic.py
View
8 django/contrib/contenttypes/generic.py
@@ -379,6 +379,12 @@ def get_formset(self, request, obj=None):
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 @@ def get_formset(self, request, obj=None):
"can_order": False,
"fields": fields,
"max_num": self.max_num,
- "exclude": self.exclude
+ "exclude": exclude
}
return generic_inlineformset_factory(self.model, **defaults)
Please sign in to comment.
Something went wrong with that request. Please try again.