Prevent infinite recursion in Django 1.6

fix_request_path_info
Evan Borgstrom 2014-03-13 16:39:13 -04:00
parent b73f22f4e0
commit 134c44bef0
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 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)