#28059 closed Bug (fixed)
ModelAdmin.radio_fields doesn't render admin.HORIZONTAL CSS classes
Reported by: | Musen | Owned by: | Musen |
---|---|---|---|
Component: | contrib.admin | Version: | 1.11 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
To reproduce the bug, suppose we have the model Person
defined in models.py
class Person(models.Model): age = models.CharField(max_length=1, 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.
Change History (6)
comment:1 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:3 by , 8 years ago
Description: | modified (diff) |
---|---|
Severity: | Normal → Release blocker |
Summary: | Admin page cannot render horizontal radio buttons → ModelAdmin.radio_fields doesn't render admin.HORIZONTAL CSS classes |
Triage Stage: | Unreviewed → Accepted |
Version: | master → 1.11 |
Note:
See TracTickets
for help on using tickets.
It's a regression in 1.11 caused by template-based widget rendering.
In older versions, the generated HTML looks like:
<ul class="radiolist inline" id="id_age">
but the classes are now missing as the multiple_input.html template doesn't consider them.