📜  django 将用户添加到组 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:39.722000             🧑  作者: Mango

代码示例3
from django.contrib.auth.models import Group
my_group = Group.objects.get(name='my_group_name') 
my_group.user_set.add(your_user)