I try something with readonly field in Django 1.8.7, let say I have some code like the following:
class MyAdmin(admin.ModelAdmin):
readonly_fields = ('a', 'b')
def get_readonly_fields(self, request, obj=None):
if not request.user.is_superuser:
self.readonly_fields += ('c')
return super(MyAdmin, self).get_readonly_fields(request, obj)
first I login with super admin and access that admin page change_form,
the code is works well, then I login with staff user, then still works well, again, I try login with superadmin, but the read only fields rendered is for the non-superadmin user,
again I clear the browser cache, try again with super admin, but still not work correctly. I try restart the server, then it work normally until I repeat the same step above I do, this weird thing come again.
Anyone know why this happen ? I think this is looks like some bug but not sure.
Thanks in Advance.