Beispiel #1
0
def add_family_group_submit(request, project_id):
    project = get_object_or_404(Project, project_id=project_id)
    if not project.can_admin(request.user):
        return HttpResponse('unauthorized')

    error = None

    form = AddFamilyGroupForm(project, request.POST)
    if form.is_valid():
        # todo: move to sample_anagement
        family_group = FamilyGroup.objects.create(
            project=project,
            slug=form.cleaned_data['family_group_slug'],
            name=form.cleaned_data['name'],
            description=form.cleaned_data['description'],
        )
        for family in form.cleaned_data['families']:
            family_group.families.add(family)
    else:
        error = server_utils.form_error_string(form)

    if error:
        return server_utils.JSONResponse({'is_error': True, 'error': error})
    else:
        return server_utils.JSONResponse({'is_error': False, 'new_url': reverse('family_group_home', args=(project.project_id, family_group.slug))})
Beispiel #2
0
def add_family_group(request, project_id):

    error = None

    project = get_object_or_404(Project, project_id=project_id)
    if not project.can_admin(request.user):
        raise PermissionDenied

    form = AddFamilyGroupForm(project, request.POST)
    if form.is_valid():
        # todo: move to sample_anagement
        family_group = FamilyGroup.objects.create(
            project=project,
            slug=form.cleaned_data['family_group_slug'],
            name=form.cleaned_data['name'],
            description=form.cleaned_data['description'],
        )
        for family in form.cleaned_data['families']:
            family_group.families.add(family)
    else:
        error = server_utils.form_error_string(form)

    if error:
        return server_utils.JSONResponse({'is_error': True, 'error': error})
    else:
        return redirect('family_group_home', project.project_id,
                        family_group.slug)
Beispiel #3
0
def add_family_group_submit(request, project_id):
    project = get_object_or_404(Project, project_id=project_id)
    if not project.can_admin(request.user):
        return HttpResponse('unauthorized')

    error = None

    form = AddFamilyGroupForm(project, request.POST)
    if form.is_valid():
        # todo: move to sample_anagement
        family_group = FamilyGroup.objects.create(
            project=project,
            slug=form.cleaned_data['family_group_slug'],
            name=form.cleaned_data['name'],
            description=form.cleaned_data['description'],
        )
        for family in form.cleaned_data['families']:
            family_group.families.add(family)
    else:
        error = server_utils.form_error_string(form)

    if error:
        return server_utils.JSONResponse({'is_error': True, 'error': error})
    else:
        return server_utils.JSONResponse({
            'is_error':
            False,
            'new_url':
            reverse('family_group_home',
                    args=(project.project_id, family_group.slug))
        })
Beispiel #4
0
def add_family_group(request, project_id):

    error = None

    project = get_object_or_404(Project, project_id=project_id)
    if not project.can_admin(request.user):
        raise PermissionDenied

    form = AddFamilyGroupForm(project, request.POST)
    if form.is_valid():
        # todo: move to sample_anagement
        family_group = FamilyGroup.objects.create(
            project=project,
            slug=form.cleaned_data['family_group_slug'],
            name=form.cleaned_data['name'],
            description=form.cleaned_data['description'],
        )
        for family in form.cleaned_data['families']:
            family_group.families.add(family)
    else:
        error = server_utils.form_error_string(form)

    if error:
        return server_utils.JSONResponse({'is_error': True, 'error': error})
    else:
        return redirect('family_group_home', project.project_id, family_group.slug )
Beispiel #5
0
def add_family_group(request, project_id):

    error = None

    project = get_object_or_404(Project, project_id=project_id)
    if not project.can_admin(request.user):
        return HttpResponse("unauthorized")

    form = AddFamilyGroupForm(project, request.POST)
    if form.is_valid():
        # todo: move to sample_anagement
        family_group = FamilyGroup.objects.create(
            project=project,
            slug=form.cleaned_data["family_group_slug"],
            name=form.cleaned_data["name"],
            description=form.cleaned_data["description"],
        )
        for family in form.cleaned_data["families"]:
            family_group.families.add(family)
    else:
        error = server_utils.form_error_string(form)

    if error:
        return server_utils.JSONResponse({"is_error": True, "error": error})
    else:
        return redirect("family_group_home", project.project_id, family_group.slug)
def add_family_group_submit(request, project_id):
    project = get_object_or_404(Project, project_id=project_id)
    if not project.can_admin(request.user):
        raise PermissionDenied

    error = None

    form = AddFamilyGroupForm(project, request.POST)
    if form.is_valid():
        # todo: move to sample_anagement
        family_group, created = get_or_create_xbrowse_model(
            FamilyGroup,
            project=project,
            slug=form.cleaned_data['family_group_slug'],
        )
        update_xbrowse_model(family_group, name=form.cleaned_data['name'], description=form.cleaned_data['description'])

        seqr_analysis_group = find_matching_seqr_model(family_group)
        for family in form.cleaned_data['families']:
            family_group.families.add(family)
            seqr_analysis_group.families.add(find_matching_seqr_model(family))
    else:
        error = server_utils.form_error_string(form)

    if error:
        return server_utils.JSONResponse({'is_error': True, 'error': error})
    else:
        return server_utils.JSONResponse({'is_error': False, 'new_url': reverse('family_group_home', args=(project.project_id, family_group.slug))})
Beispiel #7
0
def add_family_group_submit(request, project_id):
    project = get_object_or_404(Project, project_id=project_id)
    if not project.can_admin(request.user):
        raise PermissionDenied

    error = None

    form = AddFamilyGroupForm(project, request.POST)
    if form.is_valid():
        # todo: move to sample_anagement
        family_group, created = get_or_create_xbrowse_model(
            FamilyGroup,
            project=project,
            slug=form.cleaned_data['family_group_slug'],
        )
        update_xbrowse_model(family_group,
                             name=form.cleaned_data['name'],
                             description=form.cleaned_data['description'])

        seqr_analysis_group = find_matching_seqr_model(family_group)
        for family in form.cleaned_data['families']:
            family_group.families.add(family)
            seqr_analysis_group.families.add(find_matching_seqr_model(family))
    else:
        error = server_utils.form_error_string(form)

    if error:
        return server_utils.JSONResponse({'is_error': True, 'error': error})
    else:
        return server_utils.JSONResponse({
            'is_error':
            False,
            'new_url':
            reverse('family_group_home',
                    args=(project.project_id, family_group.slug))
        })