mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Django 1.6 changed the MultiWidget.needs_multipart_form attribute into a property. We didn't plan for that in floppify code yet. We check now for properties which makes it compatible with Django 1.6 and more futureproof. Part of a Fix for #387.
This commit is contained in:
parent
d9530074e4
commit
ca86c60499
1 changed files with 7 additions and 1 deletions
|
|
@ -28,7 +28,13 @@ def _copy_attributes(original, new_widget, attributes):
|
|||
for attr in attributes:
|
||||
original_value = getattr(original, attr)
|
||||
original_value = deepcopy(original_value)
|
||||
setattr(new_widget, attr, original_value)
|
||||
|
||||
# Don't set the attribute if it is a property. In that case we can be
|
||||
# sure that the widget class is taking care of the calculation for that
|
||||
# property.
|
||||
old_value_on_new_widget = getattr(new_widget.__class__, attr, None)
|
||||
if not isinstance(old_value_on_new_widget, property):
|
||||
setattr(new_widget, attr, original_value)
|
||||
|
||||
|
||||
def _create_widget(widget_class, copy_attributes=(), init_arguments=()):
|
||||
|
|
|
|||
Loading…
Reference in a new issue