예제 #1
0
def add_user_to_project(projectID, username, user_role):
    try:
        proj = Project.objects.get(id=projectID)
        user = User.objects.get(username=username)
        association = UserAssociation(user=user, project=proj, role=user_role)
        association.save()

    except ObjectDoesNotExist:
        return
예제 #2
0
def add_user_to_project(projectID, username, user_role):
    try:
        proj = Project.objects.get(id=projectID)
        user = User.objects.get(username=username)
        association = UserAssociation(user=user, project=proj, role=user_role)
        association.save()

    except ObjectDoesNotExist:
        return
예제 #3
0
def create_project(user, fields):
    if user is None: return None
    if fields is None: return None
    try:
        u = User.objects.get(id=user.id)
    except ObjectDoesNotExist:
        return None
    
    title = fields.get('title', '')
    description = fields.get('description', '')
    proj = Project(title=title, description=description)
    proj.save()
    association = UserAssociation(user=user,project=proj, role=user_association.ROLE_OWNER)
    association.save()
    return proj
예제 #4
0
def create_project(user, fields):
    if user is None: return None
    if fields is None: return None
    try:
        u = User.objects.get(id=user.id)
    except ObjectDoesNotExist:
        return None

    title = fields.get('title', '')
    description = fields.get('description', '')
    proj = Project(title=title, description=description)
    proj.save()
    association = UserAssociation(user=user,
                                  project=proj,
                                  role=user_association.ROLE_OWNER)
    association.save()
    return proj