#28059: Admin page cannot render horizontal radio buttons
-------------------------------+--------------------------------------
     Reporter:  Musen          |                    Owner:  Musen
         Type:  Bug            |                   Status:  assigned
    Component:  contrib.admin  |                  Version:  master
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Description changed by Musen:

Old description:

> 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.

New description:

 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.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/28059#comment:2>
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/067.0cdf43f589ba618882d4058a6c2835aa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to