mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.5.x] Fixed #19423 -- Prevented ModelAdmin sharing widgets due to formfield_overrides
Thanks joebuyer at manycycles.com for the report and Simon Charette
for the review.
Backport of 04e6542b5 from master.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import copy
|
||||
from functools import update_wrapper, partial
|
||||
import warnings
|
||||
|
||||
@@ -130,7 +131,7 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)):
|
||||
# passed to formfield_for_dbfield override the defaults.
|
||||
for klass in db_field.__class__.mro():
|
||||
if klass in self.formfield_overrides:
|
||||
kwargs = dict(self.formfield_overrides[klass], **kwargs)
|
||||
kwargs = dict(copy.deepcopy(self.formfield_overrides[klass]), **kwargs)
|
||||
return db_field.formfield(**kwargs)
|
||||
|
||||
# For any other type of field, just call its formfield() method.
|
||||
|
||||
Reference in New Issue
Block a user