1👍
✅
You can use a post_save
Django Signal on the User model, which runs after the User.save()
is done, so in your case you want to test for instance.is_active
, while you’re you can also revoke the permissions in the signal if the user is set as is_active = False
This is also better than overriding some admin interface, because the post_save
will run after the model save, regardless if done from admin panel or elsehwere
https://docs.djangoproject.com/en/1.8/ref/signals/#django.db.models.signals.post_save
Source:stackexchange.com