Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix multi-fields in single line #539

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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