[Django]-Django how to remove a user from a group

37👍

See documentation https://docs.djangoproject.com/en/stable/topics/auth/#methods

g.user_set.remove(your_user)
👤TigorC

18👍

The simplest method to clear all user groups from the user object is

user_obj.groups.clear()

16👍

To remove a specific Group:

group = Group.objects.get(name='groupname') 
user.groups.remove(group)

Leave a comment