def giver_create(request, giver_id): giver = Giver.objects.get(id=giver_id) if request.method == "POST": giver_info = GiverForm(request.POST, instance=giver) if giver_info.is_valid(): if giver_info.save(): return redirect("charity_dashboard") else: giver_info = GiverForm(instance=giver) data = {'giver_info': giver_info, "giver": giver} return render(request, 'giver_home.html', data)
def new_giver(request): if request.method == "POST": form3 = GiverForm(request.POST) if form3.is_valid(): giver = form3.save(commit=False) giver.user = request.user giver.save() return redirect("/givers") else: form3 = GiverForm() data = {'form3': form3} return render(request, "givers/new_giver.html", data)
def fbedit_giver(request, fbgiver_id): giver = Giver.objects.get(id= fbgiver_id) if request.method == "POST": form3 = GiverForm(request.POST, instance= giver) print "POST" if form3.is_valid(): if form3.save(): return redirect("fbgivers") else: form3 = GiverForm(instance= giver) data = {"giver": giver, "form3": form3} print form3 return render(request, "fbgivers/fb_edit_giver.html", data)
def fbedit_giver(request, fbgiver_id): giver = Giver.objects.get(id=fbgiver_id) if request.method == "POST": form3 = GiverForm(request.POST, instance=giver) print "POST" if form3.is_valid(): if form3.save(): return redirect("fbgivers") else: form3 = GiverForm(instance=giver) data = {"giver": giver, "form3": form3} print form3 return render(request, "fbgivers/fb_edit_giver.html", data)
def edit_giver(request, giver_id): giver = Giver.objects.get(id= giver_id) print giver if request.method == "POST": form3 = GiverForm(request.POST, instance= giver) print "POST" if form3.is_valid(): if form3.save(): return redirect("/givers/{}".format(giver_id)) else: form3 = GiverForm(instance= giver) data = {"giver": giver, "form3": form3} print form3 return render(request, "givers/edit_giver.html", data)