How to work on this particular situation in django admin?
class Foo(models.Model):
bar_protected = models.BooleanField(default=False)
bar = models.CharField(max_length=50
Here I am customizing django admin. Now I have two fiel开发者_StackOverflow中文版d in the model. By Default I want that 'bar' remains disabled. (Not Hide). And bar_protected unchecked. When some one checked bar_protected , bar enabled.
Django have disabled facilities But when I do, It hides the bar Field.
Thanks in advance.
You should either use editable = False
in the model for that field or put it in readonly_fields
while registering the model in the admin.py file. This should work.
精彩评论