Skip to content

Commit

Permalink
fix: setting DJANGOCMS_FRONTEND_MINIMUM_INPUT_LENGTH caused a regre…
Browse files Browse the repository at this point in the history
…ssion when updating opt groups (#230)
  • Loading branch information
fsbraun authored Jul 13, 2024
1 parent e1b373d commit a73e887
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion djangocms_frontend/contrib/link/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def build_attrs(self, base_attrs, extra_attrs=None):

def optgroups(self, name, value, attr=None):
groups = super(forms.Select, self).optgroups(name, value)
if not self.is_required:
if not self.is_required and groups:
# Add an empty entry to allow for an empty value to be preselected
groups[0][1].insert(0, self.create_option(name, "", "", False, 0))
return groups

Expand Down

0 comments on commit a73e887

Please sign in to comment.