A
A
Alexander Vinogradov2018-04-06 08:00:35
Django
Alexander Vinogradov, 2018-04-06 08:00:35

How to assign a radioselect widget to a BooleanField field in the admin?

There is a model with a field
on_main = models.BooleanField(verbose_name='On the main', default=False)
Its function is to specify which menu item is the main page.
Task: in the admin panel, where list_editable = ('to_publish', 'on_main', 'usort') is displayed, this field must have a radio button widget, i.e. if in one line it is set to on, it should be turned off on the rest.
How to implement it?
For a long time, at the training stage, I did this and it’s not difficult, but I don’t remember how and I can’t find where I got it from.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question