diff options
Diffstat (limited to 'ctrack/core')
-rw-r--r-- | ctrack/core/utils.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/ctrack/core/utils.py b/ctrack/core/utils.py index ef998d0..fb49235 100644 --- a/ctrack/core/utils.py +++ b/ctrack/core/utils.py @@ -2,7 +2,8 @@ import random from random import choice, randint from django.contrib.auth import get_user_model -from django.contrib.auth.models import Group +from django.contrib.auth.models import Group, Permission +from django.db.models import Q from faker import Faker from ctrack.assessments.models import ( @@ -73,6 +74,32 @@ def populate_db(**kwargs): # Groups cct_staff_group = Group.objects.create(name="cct_users") + ctrack_permissions = Permission.objects.filter( + Q(codename__contains="address") + | Q(codename__contains="addresstype") + | Q(codename__contains="mode") + | Q(codename__contains="organisation") + | Q(codename__contains="role") + | Q(codename__contains="submode") + | Q(codename__contains="person") + | Q(codename__contains="applicablesystem") + | Q(codename__contains="caf") + | Q(codename__contains="documentfile") + | Q(codename__contains="filestore") + | Q(codename__contains="grading") + | Q(codename__contains="engagementtype") + | Q(codename__contains="engagementevent") + | Q(codename__contains="cafassessment") + | Q(codename__contains="cafobjective") + | Q(codename__contains="cafprinciple") + | Q(codename__contains="cafcontributingoutcome") + | Q(codename__contains="cafassessmentoutcomescore") + | Q(codename__contains="achievmentlevel") + | Q(codename__contains="igp") + | Q(codename__contains="stakeholder") + | Q(codename__contains="incidentreport") + ) + cct_staff_group.permissions.add(*ctrack_permissions) # Set up some reasonable Modes and SubModes m1 = Mode.objects.create(descriptor="Rail") |