usuario isn't a username, it's a QuerySet so I don't think: User.objects.get(username=usuario)
... will work. Please post the specific error you're getting including any traceback. On August 16, 2022 3:30:46 PM CDT, "José Ángel Encinas" <[email protected]> wrote: >hi guys, im trying to remove user from a specific group using a function in >django but can to do it, can help me someone? > >this is the function >def accesstosystem(request): > usuario = User.objects.filter(groups__name='revisión') > user = User.objects.get(username=usuario) > group = Group.objects.get(name='revisión') > user.groups.remove(group) > >kind regards > >-- >You received this message because you are subscribed to the Google Groups >"Django users" group. >To unsubscribe from this group and stop receiving emails from it, send an >email to [email protected]. >To view this discussion on the web visit >https://groups.google.com/d/msgid/django-users/d36d5c76-9824-4971-94ed-a2288827b656n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/482D57FC-EA71-4681-B824-92517C65770A%40fattuba.com.

