#28059: Admin page cannot render horizontal radio buttons
-----------------------------------------+------------------------
               Reporter:  Musen          |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  contrib.admin  |        Version:  master
               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              |
-----------------------------------------+------------------------
 To reproduce the bug, suppose we have the model `Person` defined in
 `models.py`

 {{{
 class Person(Models.model):
     age = CharField(choices = (('Y', 'Young'), ('O', 'Old')))
 }}}
 We want to display the choice of age in our admin change page in radio
 buttons, so we have the following codes in `admin.py`
 {{{
 from .models import Person

 class PersonAdmin(admin.ModelAdmin):
     radio_fields = {'age': admin.HORIZONTAL}

 admin.site.register(Person, PersonAdmin)
 }}}

 Then, we will get the vertical radio buttons instead of the horizontal
 ones.

 The bug is caused by the wrong HTML attribute that the `ModelAdmin` uses
 to produce horizontal radio buttons. The correct attribute is `radio-
 inline` but `ModelAdmin` uses `radiolist inline`. Also, since HTML uses
 the vertical radio buttons as default, function `get_ul_class` is useless,
 and it can be simply replaced by an if statement.

--
Ticket URL: <https://code.djangoproject.com/ticket/28059>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.9171d3b8aceff0a82fd0cf87592681b6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to