def upsert(request, pk=None, cost_pk=None): pc, cu_stator = get_project_cost(cost_pk, pk, CuStator) form = forms.CuStatorForm(request.POST or None, instance=cu_stator) if request.method == 'POST': if form.is_valid(): cu_stator = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=cu_stator.project_cost.pk) context = {'form': form, 'pc': pc, 'cu_stator': cu_stator} return render(request, 'cost/cu_stator/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, other = get_project_cost(cost_pk, pk, Other) form = forms.OtherForm(request.POST or None, instance=other) if request.method == 'POST': if form.is_valid(): other = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=other.project_cost.pk) context = {'form': form, 'pc': pc, 'other': other} return render(request, 'cost/other/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, bearing_cost = get_project_cost(cost_pk, pk, BearingCost) form = forms.BearingCostForm(request.POST or None, instance=bearing_cost) if request.method == 'POST': if form.is_valid(): bearing_cost = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=bearing_cost.project_cost.pk) context = {'form': form, 'bearing_cost': bearing_cost, 'pc': pc} return render(request, 'cost/bearing_cost/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, steel_rebar = get_project_cost(cost_pk, pk, SteelRebar) form = forms.SteelRebarForm(request.POST or None, instance=steel_rebar) if request.method == 'POST': if form.is_valid(): steel_rebar = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=steel_rebar.project_cost.pk) context = {'form': form, 'pc': pc, 'steel_rebar': steel_rebar} return render(request, 'cost/steel_rebar/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, overhead = get_project_cost(cost_pk, pk, OverheadCost) form = forms.OverheadForm(request.POST or None, instance=overhead) if request.method == 'POST': if form.is_valid(): overhead = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=overhead.project_cost.pk) context = {'form': form, 'pc': pc, 'overhead': overhead} return render(request, 'cost/overhead/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, insulation = get_project_cost(cost_pk, pk, Insulation) form = forms.InsulationForm(request.POST or None, instance=insulation) if request.method == 'POST': if form.is_valid(): insulation = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=insulation.project_cost.pk) context = {'form': form, 'pc': pc, 'insulation': insulation} return render(request, 'cost/insulation/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, silicon_sheet = get_project_cost(cost_pk, pk, SiliconSheet) form = forms.SiliconSheetForm(request.POST or None, instance=silicon_sheet) if request.method == 'POST': if form.is_valid(): silicon_sheet = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=silicon_sheet.project_cost.pk) context = {'form': form, 'pc': pc, 'silicon_sheet': silicon_sheet} return render(request, 'cost/silicon_sheet/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, wage = get_project_cost(cost_pk, pk, WageCost) form = forms.WageForm(request.POST or None, instance=wage) if request.method == 'POST': if form.is_valid(): wage = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=wage.project_cost.pk) context = {'form': form, 'wage': wage, 'cost': pc} return render(request, 'cost/wage/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, alu_ingot = get_project_cost(cost_pk, pk, AluIngot) form = forms.AluIngotForm(request.POST or None, instance=alu_ingot) if request.method == 'POST': if form.is_valid(): alu_ingot = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=alu_ingot.project_cost.pk) context = { 'form': form, 'alu_ingot': alu_ingot, 'pc': pc } return render(request, 'cost/alu_ingot/upsert.html', context)
def upsert(request, pk=None, cost_pk=None): pc, certificate_cost = get_project_cost(cost_pk, pk, CertificateCost) form = forms.CertificateCostForm(request.POST or None, instance=certificate_cost) if request.method == 'POST': if form.is_valid(): certificate_cost = handle_valid_cost_row_form(form, pc, pk, request) return redirect('cost:cost', pk=certificate_cost.project_cost.pk) context = { 'form': form, 'certificate_cost': certificate_cost, 'pc': pc, } return render(request, 'cost/certificate_cost/upsert.html', context)