Skip to content

Commit

Permalink
Improve fix of PR #321
Browse files Browse the repository at this point in the history
checking hasattr(self, 'fieldsets') alway returns true, and produces
different effects. The hasattr(self, 'declared_fieldsets') was designed
to detect whether Django injected that attribute.

Amends: 5e150ea
  • Loading branch information
vdboor committed Dec 22, 2017
1 parent 8f0932b commit a2ba525
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion polymorphic/admin/childadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def history_view(self, request, object_id, extra_context=None):

def get_fieldsets(self, request, obj=None):
# If subclass declares fieldsets or fields, this is respected
if hasattr(self, 'fieldsets') or hasattr(self, 'fields') or not self.base_fieldsets:
if self.fieldsets or self.fields or not self.base_fieldsets:
return super(PolymorphicChildModelAdmin, self).get_fieldsets(request, obj)

# Have a reasonable default fieldsets,
Expand Down

0 comments on commit a2ba525

Please sign in to comment.