Skip to content

Commit

Permalink
Fix multi-fields in single line
Browse files Browse the repository at this point in the history
  • Loading branch information
morsik authored and jleclanche committed Nov 17, 2023
1 parent b2d3ab7 commit bd2ff0b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion polymorphic/admin/childadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,15 @@ def get_subclass_fields(self, request, obj=None):

# Find which fields are not part of the common fields.
for fieldset in self.get_base_fieldsets(request, obj):
for field in fieldset[1]["fields"]:
# multiple elements in single line
if isinstance(field, tuple):
for line_field in field:
try:
subclass_fields.remove(line_field)
except ValueError:
pass # field not found in form, Django will raise exception later.
else:
# regular one-element-per-line
try:
subclass_fields.remove(field)
except ValueError:
Expand Down

0 comments on commit bd2ff0b

Please # to comment.