#29273: MultipleChoiceField incorrectly selects the empty value for an empty
form
----------------------------------+------------------------------------
Reporter: Tim Kleinschmidt | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Tim Graham):
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
The difference can be seen here:
{{{
from django import forms
choices = [('', '(no extra)'), ('cheese', 'Cheese'), ('Pepper', 'Pepper')]
class Form(forms.Form):
extra_topics = forms.MultipleChoiceField(required=False,
choices=choices)
form = Form()
print(form)
}}}
The first option renders as `<option value="" selected>(no
extra)</option>` in Django 1.11+ but without `selected` in older versions.
--
Ticket URL: <https://code.djangoproject.com/ticket/29273#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.4fdc5f8d693bd446790ff003033e3f69%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.