#32434: Using a RadioSelect widget with ModelChoiceField results in no empty 
option
-------------------------------------+-------------------------------------
               Reporter:  Matthew    |          Owner:  nobody
  Rowbottom                          |
                   Type:  Bug        |         Status:  new
              Component:  Forms      |        Version:  3.1
               Severity:  Normal     |       Keywords:  modelchoicefield
           Triage Stage:             |  radioselect
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  1          |
-------------------------------------+-------------------------------------
 Prior to Django v3.1, both of the fields in the following form would be
 rendered with an empty option, labelled as '---------':

 {{{#!python
 from django import forms
 from .models import Animal

 class AnimalForm(forms.Form):
     animal_select = forms.ModelChoiceField(
         queryset=Animal.objects.all(),
         required=False,
     )
     animal_radio = forms.ModelChoiceField(
         queryset=Animal.objects.all(),
         required=False,
         widget=forms.RadioSelect()
     )
 }}}

 Since Django v3.1, the field using the RadioSelect widget no longer
 displays the empty option.

 I've tested it with the following versions:

 3.0    works
 3.0.12    works
 3.1    broken
 3.1.6     broken
 3.2a1    broken

 I can't find anything in the docs or the v3.1 release notes
 (https://docs.djangoproject.com/en/dev/releases/3.1/#forms) to explain the
 change.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32434>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.b3908f474d97ff29ef2ec0038270c19d%40djangoproject.com.

Reply via email to