class CustomAdmin(admin.ModelAdmin):

    def get_readonly_fields(self, request, obj=None):
        if request.user.is_superuser:
            return self.readonly_fields
if self.declared_fieldsets:
    return flatten_fieldsets(self.declared_fieldsets)
else:
    return list(set([field.name for field in self.opts.local_fields] + [
        field.name for field in self.opts.local_many_to_many]))
Django admin - make all fields readonly