Is it possible to display the option buttons instead of select box (in the admin interface) for ChoiceField
? Any suggestions?
相关问题
- Django __str__ returned non-string (type NoneType)
- Django & Amazon SES SMTP. Cannot send email
- Django check user group permissions
- Django restrict pages to certain users
- UnicodeEncodeError with attach_file on EmailMessag
相关文章
- TypeError: 'BaseQuery' object is not calla
- Profiling Django with PyCharm
- Why doesn't Django enforce my unique_together
- MultiValueDictKeyError in Django admin
- Django/Heroku: FATAL: too many connections for rol
- Django is sooo slow? errno 32 broken pipe? dcramer
- Django: Replacement for the default ManyToMany Wid
- Upgrading transaction.commit_manually() to Django
There's a snippet on djangosnippets that seems to do something like this for forms given a list of choices, but it doesn't seem to specifically do it for the admin app. You might be able to either leverage this or the ideas within it to get you the rest of the way though.
Yes.
In your admin.py create a ModelAdmin class:
I'm not sure what you mean by "option buttons" rather than select box, but this is how you change it. You can find the right widget here: http://docs.djangoproject.com/en/dev/ref/forms/widgets/
The following
ModelAdmin
subclass (in your admin.py) does what you're after:HORIZONTAL
is also possible.From the Django docs.