Django has
list_editable. I need to editis_activeflag.class MyUserAdminForm(ModelForm):
class Meta:
model = User
def clean_is_active(self):
# do something that validates your data
print ' I am here... '
print self.cleaned_data
print self
class MyUserAdmin(admin.ModelAdmin):
.... SOME CODE ....
form = MyUserAdminForm
admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)I put this in
admin.py, and I've registered myadmin.ModelAdmincode. The display is fine.The code above should fail because it doesn't return
self.cleaned_data["is_active"]. But when I reload the development server, and changed the flag on some users, Django didn't complain, so this piece of code is not used.My requirement is to check that the user under change is not a superuser. I have other things to do within that validation, but you get the idea.
Why is this?
Thanks.