示例#1
0
def edit_budget_op(request, budgetlineId):
    context = RequestContext(request)
    user = request.user
    bl = BudgetLine.objects.get(id=budgetlineId)

    project = Project.objects.get(id=bl.project.id)
    user_is_owner(user, project)

    redirect = get_redirect_url(request) + str("#budget_detail")

    if request.method == "POST":

        if "delete" in request.POST:
            bl.delete()
            return HttpResponseRedirect(redirect)

        else:
            form = BudgetLineOP(request.POST, instance=bl)

            if form.is_valid():
                form.save()

                return HttpResponseRedirect(redirect)

    else:
        form = BudgetLineOP(instance=bl)

    return render_to_response("rfp/edit_budget_op.html", {"form": form, "user": user, "bl": bl}, context)
示例#2
0
def edit_budget_op(request, budgetlineId):
    context = RequestContext(request)
    user = request.user
    bl = BudgetLine.objects.get(id = budgetlineId )

    project=Project.objects.get(id = bl.project.id)
    user_is_owner(user,project)

    redirect = get_redirect_url(request)+ str('#budget_detail')

    if request.method == 'POST':

        if 'delete' in request.POST:
             bl.delete()
             return HttpResponseRedirect(redirect)

        else:
            form = BudgetLineOP(request.POST,instance=bl)

            if form.is_valid() :
                form.save()

                return HttpResponseRedirect(redirect)

    else:
        form = BudgetLineOP(instance=bl)

    return render_to_response('rfp/edit_budget_op.html',{'form' : form, 'user' : user,'bl': bl},context)
示例#3
0
def add_budget_op(request, projectId):
    context = RequestContext(request)
    user = request.user
    project = Project.objects.get(pk=projectId)
    user_is_owner(user, project)
    redirect = get_redirect_url(request) + str("#budget_detail")

    if request.method == "POST":

        form = BudgetLineOP(request.POST)

        if form.is_valid():
            bl = form.save(commit=False)
            bl.project = project
            bl.category = "OC"
            bl.save()

            return HttpResponseRedirect(redirect)

    else:
        form = BudgetLineOP()

    return render_to_response("rfp/add_budget_op.html", {"form": form, "user": user, "project": project}, context)
示例#4
0
def add_budget_op(request, projectId):
    context = RequestContext(request)
    user = request.user
    project = Project.objects.get(pk = projectId)
    user_is_owner(user,project)
    redirect = get_redirect_url(request) + str('#budget_detail')

    if request.method == 'POST':

        form = BudgetLineOP(request.POST)

        if form.is_valid() :
            bl = form.save(commit=False)
            bl.project = project
            bl.category = 'OC'
            bl.save()

            return HttpResponseRedirect(redirect)

    else:
        form = BudgetLineOP()

    return render_to_response('rfp/add_budget_op.html',{'form' : form, 'user' : user, 'project' : project},context)