-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_groups.py
More file actions
29 lines (20 loc) · 737 Bytes
/
make_groups.py
File metadata and controls
29 lines (20 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Make the groups necessary for the project."""
# Set up django environment.
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "irg_realtime.settings")
import django
django.setup()
from django.contrib.auth.models import Group
def build_all_groups():
"""Build all groups needed, only if they don't already exist."""
# Site Admins
# Members of this group can make notifications, and manage users.
try:
site_admins = Group.objects.get(name="Site Admins")
print("Found group Site Admins.")
except Group.DoesNotExist:
site_admins = Group(name='Site Admins')
site_admins.save()
print("Created group Site Admins.")
if __name__ == '__main__':
build_all_groups()