Django has list_editable. I need to edit is_active flag. 

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 my admin.ModelAdmin code. 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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/8nrBEiPwhrEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to