Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django add user to group

from django.contrib.auth.models import Group, User
tonystark=User.objects.get(id=pk)
hulk=Group.objects.get(name='groupname')
hulk.user_set.add(tonystark)
Source by re-cycledair.com #
 
PREVIOUS NEXT
Tagged: #django #add #user #group
ADD COMMENT
Topic
Name
8+7 =