Skip to content

Commit

Permalink
Fix for broken fix about multi-fields in single line
Browse files Browse the repository at this point in the history
Fix for error in #539
  • Loading branch information
morsik authored and jleclanche committed Nov 18, 2023
1 parent bd2ff0b commit be374e2
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions polymorphic/admin/childadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,18 @@ 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):
# multiple elements in single line
if isinstance(field, tuple):
for line_field in field:
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(line_field)
subclass_fields.remove(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:
pass # field not found in form, Django will raise exception later.
return subclass_fields

0 comments on commit be374e2

Please # to comment.