Reputation: 11
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 field 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.
Upvotes: 1
Views: 83
Reputation: 23437
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.
Upvotes: 3