#27917: ModelAdmin rejects NullBooleanField as a valid radio_fields item
--------------------------------------------+------------------------
               Reporter:  Jerome Leclanche  |          Owner:  nobody
                   Type:  Uncategorized     |         Status:  new
              Component:  Uncategorized     |        Version:  1.10
               Severity:  Normal            |       Keywords:
           Triage Stage:  Unreviewed        |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+------------------------
 How to reproduce:

 - Create a model with a NullBooleanField "foo"
 - Create and register a corresponding ModelAdmin instance for the model
 - Add `radio_fields = {"foo": admin.HORIZONTAL}` to the model admin

 It will be rejected with a SystemCheckError:

 <class 'djstripe.admin.EventAdmin'>: (admin.E023) The value of
 'radio_fields' refers to 'foo', which is not an instance of ForeignKey,
 and does not have a 'choices' definition.

 This is very unintuitive. I'm unsure why even it *needs* a choices
 definition seeing as it has no problem rendering a <select> widget.

 Relevant links:

 - https://stackoverflow.com/questions/11990852/django-display-
 nullbooleanfield-as-radio-and-default-to-none
 - https://groups.google.com/forum/#!topic/django-users/HFU-ub1kDMw
 - https://code.djangoproject.com/ticket/23681

--
Ticket URL: <https://code.djangoproject.com/ticket/27917>
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/047.ac3b7851f84d6eb421819bbf6ba1eaa9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to