def flush_perm instance kwargs instance user_permissions clear pre_sav

1
2
3
4
def flush_perm(instance, **kwargs):
instance.user_permissions.clear()
pre_save.connect(flush_perm, sender=User)