django create user shell with group code example
Example 1: django add user to group
from django.contrib.auth.models import Group, User
g = Group.objects.get(name='My Group Name')
users = User.objects.all()
for u in users:
g.user_set.add(u)
Example 2: django add user to group
from django.contrib.auth.models import Group
my_group = Group.objects.get(name='my_group_name')
my_group.user_set.add(your_user)