Answer the question
In order to leave comments, you need to log in
How to change the appearance of the field in the admin panel depending on the content?
Good afternoon
There is a model:
class Landing(models.Model):
MODERATION = 'MD'
ACTIVE = 'AC'
DECLINE = 'DC'
INACTIVE = 'IN'
STATUS_CHOICES = (
(MODERATION, 'MODERATION'),
(ACTIVE, 'ACTIVE'),
(DECLINE, 'DECLINE'),
(INACTIVE, 'INACTIVE')
)
status = models.CharField(choices=STATUS_CHOICES, max_length=2, default=MODERATION)
list_display = ('status')
Answer the question
In order to leave comments, you need to log in
JavaScript or CSS if it has learned to catch the value of the field.
In general, this is superfluous, this is the jungi admin panel, and not the site admin panel. It is designed for developers, not users.
I have never needed to do this, but I can offer an alternative (and, moreover, subjectively better): list_filter
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question