Find the group using Group model with the name of the group, then add the user to the user_set
from django.contrib.auth.models import Group
my_group = Group.objects.get(name="my_group_name")
my_group.user_set.add(your_user)
More Related Contents:
- ‘pip’ is not recognized as an internal or external command
- What is the difference between null=True and blank=True in Django?
- Iterate over model instance field names and values in template
- Using Django time/date widgets in custom form
- Django REST Framework upload image: “The submitted data was not a file”
- Difference between static STATIC_URL and STATIC_ROOT on Django
- Django Query That Get Most Recent Objects From Different Categories
- Django rest framework serializing many to many field
- How to compare two JSON objects with the same elements in a different order equal?
- Best practices for adding .gitignore file for Python projects? [closed]
- How do I get the object if it exists, or None if it does not exist in Django?
- Find object in list that has attribute equal to some value (that meets any condition)
- django urls without a trailing slash do not redirect
- Error: “dictionary update sequence element #0 has length 1; 2 is required” on Django 1.4
- Configure Django and Google Cloud Storage?
- AttributeError: ‘module’ object has no attribute ‘setdefaultencoding’
- CSS not loading wrong MIME type Django [duplicate]
- How to filter objects for count annotation in Django?
- Django populate() isn’t reentrant
- Distributed task queues (Ex. Celery) vs crontab scripts
- Change Django ModelChoiceField to show users’ full names rather than usernames
- InterfaceError (0, ”)
- django-debug-toolbar not showing up
- gunicorn.errors.HaltServer: django
- Django Admin Page missing CSS
- How to update manytomany field in Django?
- Django ‘AnonymousUser’ object has no attribute ‘_meta’
- Add “django-admin.py” path to command line on Windows 7
- Django Multiple Databases – relation does not exist; LINE 1: SELECT COUNT(*) AS “__count” FROM
- How do I change the range of the x-axis with datetime?