|
@ -10,6 +10,7 @@ from projects.models import (DOCUMENT_CLASSIFICATION, IMAGE_CLASSIFICATION, |
|
|
INTENT_DETECTION_AND_SLOT_FILLING, SEQ2SEQ, |
|
|
INTENT_DETECTION_AND_SLOT_FILLING, SEQ2SEQ, |
|
|
SEQUENCE_LABELING, SPEECH2TEXT, Member) |
|
|
SEQUENCE_LABELING, SPEECH2TEXT, Member) |
|
|
from roles.models import Role |
|
|
from roles.models import Role |
|
|
|
|
|
from roles.tests.utils import create_default_roles |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectData: |
|
|
class ProjectData: |
|
@ -35,12 +36,6 @@ class ProjectData: |
|
|
return [self.approver, self.annotator] |
|
|
return [self.approver, self.annotator] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_default_roles(): |
|
|
|
|
|
Role.objects.get_or_create(name=settings.ROLE_PROJECT_ADMIN) |
|
|
|
|
|
Role.objects.get_or_create(name=settings.ROLE_ANNOTATOR) |
|
|
|
|
|
Role.objects.get_or_create(name=settings.ROLE_ANNOTATION_APPROVER) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def assign_user_to_role(project_member, project, role_name): |
|
|
def assign_user_to_role(project_member, project, role_name): |
|
|
role, _ = Role.objects.get_or_create(name=role_name) |
|
|
role, _ = Role.objects.get_or_create(name=role_name) |
|
|
if Member.objects.filter(user=project_member, project=project).exists(): |
|
|
if Member.objects.filter(user=project_member, project=project).exists(): |
|
|