Open io2 opened 3 years ago
Hi @io2
Sorry for taking some time to get to this. There's a few things going on with this at the moment.
The first is that we should probably mirror the logic from checkboxes and radios. There are a few other edge cases we should look to capture. See this line here.
Secondly is that this can be improved using the new optgroups
filter in django-crispy-forms
which will simplify this logic here significantly. See https://github.com/django-crispy-forms/django-crispy-forms/pull/1127
@smithdc1 I'll take a look sometime and push an update.
Hi @io2!
@smithdc1 I'll take a look sometime and push an update.
Any update on this topic? 🙂
Best
Ronny
in django
forms.ModelForm
types, theselect > option
value attribute is usually set to the primary key of the model object (typically an integer)This commit converts
field.value
to string to ensure theif
condition for addingselected
to the<option>
html is satisfied.