1👍
✅
Answer before question edit:
Find the group object by Label and add user object to that group.
from django.contrib.auth.models import Group
g = Group.objects.get(name=LABEL_NAME)
g.user_set.add(YOUR_USER)
Update 1:
Groups are like categories. You just put users in some categories. When we talk about group permissions, we usually handle them via utility functions such as:
def is_truck(user):
return user.groups.filter(name='truck').exists()
def is_company(user):
return user.groups.filter(name='company').exists()
or you can make properties on user objects.
Source:stackexchange.com