-
Notifications
You must be signed in to change notification settings - Fork 1
/
groups_init.py
29 lines (24 loc) · 1.2 KB
/
groups_init.py
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
from django.contrib.auth.models import User, Group, Permission
from django.contrib.contenttypes.models import ContentType
from web.models import *
"""
Groups
"""
moderator = Group(name="moderator")
moderator.save()
moderator.permissions.add(Permission.objects.get(
content_type=ContentType.objects.get_for_model(OwnershipRequest),codename='respond_to_ownership_requests'))
moderator.permissions.add(Permission.objects.get(
content_type=ContentType.objects.get_for_model(OwnershipRequest),codename='view_ownership_requests'))
moderator.permissions.add(Permission.objects.get(
content_type=ContentType.objects.get_for_model(OwnershipRequest),codename='view_historical_ownership_requests'))
moderator.permissions.add(Permission.objects.get(
content_type=ContentType.objects.get_for_model(TaxonomyItem),codename='revoke_ownership'))
moderator.save()
taxonomer = Group(name="taxonomer")
taxonomer.save()
taxonomer.permissions.add(Permission.objects.get(
content_type=ContentType.objects.get_for_model(TaxonomyItem),codename='modify_taxonomy_items'))
taxonomer.permissions.add(Permission.objects.get(
content_type=ContentType.objects.get_for_model(TaxonomyCategory),codename='modify_taxonomy_categories'))
taxonomer.save()