Opened 8 years ago

Last modified 8 years ago

#28059 closed Bug

ModelAdmin.radio_fields doesn't render admin.HORIZONTAL CSS classes — at Version 3

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 Tim Graham)

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 (3)

comment:1 by Musen, 8 years ago

Owner: changed from nobody to Musen
Status: newassigned

comment:2 by Musen, 8 years ago

Description: modified (diff)

comment:3 by Tim Graham, 8 years ago

Description: modified (diff)
Severity: NormalRelease blocker
Summary: Admin page cannot render horizontal radio buttonsModelAdmin.radio_fields doesn't render admin.HORIZONTAL CSS classes
Triage Stage: UnreviewedAccepted
Version: master1.11

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.

Note: See TracTickets for help on using tickets.
Back to Top