Is it possible to display the option buttons instead of the selection window (in the admin interface) for ChoiceField? Any suggestions?
ChoiceField
The following subclass ModelAdmin(in your admin.py) does the following:
ModelAdmin
class PersonAdmin(admin.ModelAdmin): radio_fields = {"group": admin.VERTICAL}
HORIZONTAL also possible.
HORIZONTAL
From Django docs .
djangosnippets, , , - , , , , admin. , , , .
.
admin.py ModelAdmin:
from django.contrib import admin from django.forms.widgets import RadioSelect ## originally had mistake of django.forms.extras.widgets class SomeModelAdmin(admin.ModelAdmin): formfield_overrides = { models.ChoiceField : dict(widget = RadioSelect) } admin.site.register(SomeModel, SomeModelAdmin)
, " ", , , . : http://docs.djangoproject.com/en/dev/ref/forms/widgets/
Source: https://habr.com/ru/post/1775876/More articles:Scaling Silverlight toolkit diagrams? - chartsMVC Validation Events ClientSide - eventsUsing a WPF polygon in another thread - multithreadingMySQL Conditional Where clause - mysqlРазвертывание сайта Maven завершается с отказом SCP Connection - Windows - javaEntity Structure and Views - sql-server-2008Dynamic polymorphism in PHP - polymorphismCoffeescript, как бы я написал этот пример в виде очереди, особенно цикл? - javascriptDoes JPA have the equivalent of Hibernate SQLQuery.addScalar ()? - hibernateThe FTP site is working, but I cannot connect to the Java program. I get java.net.UnknownHostException - javaAll Articles