Skip to content

Commit a73e887

Browse files
authored
fix: setting DJANGOCMS_FRONTEND_MINIMUM_INPUT_LENGTH caused a regression when updating opt groups (#230)
1 parent e1b373d commit a73e887

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

djangocms_frontend/contrib/link/forms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def build_attrs(self, base_attrs, extra_attrs=None):
109109

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

0 commit comments

Comments
 (0)