I'm trying to make all fields readonly without listing them explicitly.
Something like:
class CustomAdmin(admin.ModelAdmin):
def get_readonly_fields(self, request, obj=None):
if request.user.is_superuser:
return self.readonly_fields
return self.fields
The problem is CustomAdmin.fields
is not set at this point.
Any ideas?