Exemplo n.º 1
0
def edit_reviewer(request,proposedreviewerId):
    context = RequestContext(request)
    user = request.user
    prop_rev = ProposedReviewer.objects.get( pk = proposedreviewerId )
    project = Project.objects.get(pk = prop_rev.project.pk)
    redirect = get_redirect_url(request)

    user_is_owner(user,project)

    if request.method == 'POST':

        if 'delete' in request.POST:
             prop_rev.delete()
             return HttpResponseRedirect(redirect)
        else:
            r = ProposedReviewerForm(request.POST, instance = prop_rev)

            if r.is_valid():
                r.save()

                return HttpResponseRedirect(redirect)

    else:
        r = ProposedReviewerForm(instance= prop_rev)

    return render_to_response('rfp/edit_proposed_reviewer.html', {'f' : r, 'project' : project, 'user' : user, 'prop_rev' : prop_rev},context)
Exemplo n.º 2
0
def edit_reviewer(request, proposedreviewerId):
    context = RequestContext(request)
    user = request.user
    prop_rev = ProposedReviewer.objects.get(pk=proposedreviewerId)
    project = Project.objects.get(pk=prop_rev.project.pk)
    redirect = get_redirect_url(request)

    user_is_owner(user, project)

    if request.method == "POST":

        if "delete" in request.POST:
            prop_rev.delete()
            return HttpResponseRedirect(redirect)
        else:
            r = ProposedReviewerForm(request.POST, instance=prop_rev)

            if r.is_valid():
                r.save()

                return HttpResponseRedirect(redirect)

    else:
        r = ProposedReviewerForm(instance=prop_rev)

    return render_to_response(
        "rfp/edit_proposed_reviewer.html", {"f": r, "project": project, "user": user, "prop_rev": prop_rev}, context
    )
Exemplo n.º 3
0
def add_unique_reviewer(request, projectId):
    context = RequestContext(request)
    user = request.user
    project = Project.objects.get(pk = projectId)
    redirect = get_redirect_url(request)
    user_is_owner(user,project)

    if request.method == 'POST':

        r = ProposedReviewerForm(request.POST)
        if r.is_valid():
            reviewer = r.save(commit = False)
            reviewer.project = project
            if 'dashboard' in str(redirect):
                reviewer.type = 'ADMIN_PROPOSED'
            else:
                reviewer.type = 'USER_PROPOSED'
            reviewer.save()

            return HttpResponseRedirect(redirect + "#reviewer_detail")
    else:
        r = ProposedReviewerForm()

    return render_to_response('rfp/add_unique_review.html', {'f' : r, 'project' : project, 'user' : user},context)
Exemplo n.º 4
0
def add_unique_reviewer(request, projectId):
    context = RequestContext(request)
    user = request.user
    project = Project.objects.get(pk=projectId)
    redirect = get_redirect_url(request)
    user_is_owner(user, project)

    if request.method == "POST":

        r = ProposedReviewerForm(request.POST)
        if r.is_valid():
            reviewer = r.save(commit=False)
            reviewer.project = project
            if "dashboard" in str(redirect):
                reviewer.type = "ADMIN_PROPOSED"
            else:
                reviewer.type = "USER_PROPOSED"
            reviewer.save()

            return HttpResponseRedirect(redirect + "#reviewer_detail")
    else:
        r = ProposedReviewerForm()

    return render_to_response("rfp/add_unique_review.html", {"f": r, "project": project, "user": user}, context)