fix detecting whether childadmin has explicitly defined fields/fieldsets

(cherry picked from commit 180df8e98c)
fix_request_path_info
Tadas Dailyda 2017-11-20 17:34:05 +02:00 committed by Diederik van der Boor
parent d1c5845966
commit 5fe504d40d
1 changed files with 2 additions and 2 deletions

View File

@ -63,8 +63,8 @@ class PolymorphicChildModelAdmin(admin.ModelAdmin):
kwargs.setdefault('form', self.base_form or self.form)
# prevent infinite recursion when this is called from get_subclass_fields
if not hasattr(self, 'fieldsets') and not hasattr(self, 'fields'):
kwargs.setdefault('fields', None)
if not self.fieldsets and not self.fields:
kwargs.setdefault('fields', '__all__')
return super(PolymorphicChildModelAdmin, self).get_form(request, obj, **kwargs)