Today i came up with a requirement where i need to implement field level permission so looking for the best possible way.
class ABC(models.Model):
fiel
You can also override readonly_fields
in changeform_view
.
Try this in admin.py
class ABCAdmin(admin.ModelAdmin):
def changeform_view(self, request, *args, **kwargs)
self.readonly_fields = list(self.readonly_fields)
if request.user in group: #or another condition
self.readonly_fields.append('field2')
return super(ABCAdmin, self).changeform_view(request, *args, **kwargs)