Reputation: 43
In the Django admin, I have
readonly_fields = 'some_field'
However, creating or adding cannot edit the field. How can I accomplish this?
Upvotes: 1
Views: 298
Reputation: 28122
def get_readonly_fields(self, request, obj=None):
if obj is None:
return ()
return self.readonly_fields
(the answer, per the original poster @Ma_Mars in the question comment django admin readonly_fields = 'some_field' but create or add cannot edit the same )
Upvotes: 1