Merge pull request #69 from borgstrom/django16

Prevent infinite recursion in Django 1.6
fix_request_path_info
Diederik van der Boor 2014-04-03 14:24:52 +02:00
commit 08e900eb6d
1 changed files with 5 additions and 0 deletions

View File

@ -409,6 +409,11 @@ class PolymorphicChildModelAdmin(admin.ModelAdmin):
# Instead, pass the form unchecked here, because the standard ModelForm will just work. # Instead, pass the form unchecked here, because the standard ModelForm will just work.
# If the derived class sets the model explicitly, respect that setting. # If the derived class sets the model explicitly, respect that setting.
kwargs.setdefault('form', self.base_form or self.form) kwargs.setdefault('form', self.base_form or self.form)
# prevent infinite recursion in django 1.6+
if 'fields' not in kwargs and not self.declared_fieldsets:
kwargs['fields'] = None
return super(PolymorphicChildModelAdmin, self).get_form(request, obj, **kwargs) return super(PolymorphicChildModelAdmin, self).get_form(request, obj, **kwargs)