Exemple #1
0
def new_charity(request):
    if request.method == "POST":
        form1 = CharityForm(request.POST)
        if form1.is_valid():
            if form1.save():
                return redirect("/charities")
    else:
        form1 = CharityForm()
    data = {'form1': form1}
    return render(request, "charities/new_charity.html", data)
Exemple #2
0
def edit_charity(request, charity_id):
    charity = Charity.objects.get(id=charity_id)
    if request.method == "POST":
        form1 = CharityForm(request.POST, instance=charity)
        if form1.is_valid():
            if form1.save():
                return redirect("/charities/{}".format(charity_id))
    else:
        form1 = CharityForm(instance=charity)
    data = {"charity": charity, "form1": form1}
    return render(request, "charities/edit_charity.html", data)
Exemple #3
0
def fbedit_charity(request, fbcharity_id):
    charity = Charity.objects.get(id=fbcharity_id)
    if request.method == "POST":
        form2 = CharityForm(request.POST, instance=charity)
        if form2.is_valid():
            if form2.save():
                return redirect("fbcharities")
    else:
        form2 = CharityForm(instance=charity)
    data = {"charity": charity, "form2": form2}
    return render(request, "fbcharities/fbedit_charity.html", data)
Exemple #4
0
def new_charity(request):
    if request.method == "POST":
        form0 = CharityForm(request.POST)
        if form0.is_valid():
            charity = form0.save(commit=False)
            charity.user = request.user
            charity.save()
            return redirect("/charities")
    else:
        form0 = CharityForm()
    data = {"form0": form0}
    return render(request, "charities/new_charity.html", data)
Exemple #5
0
def fbnew_charity(request):
    if request.method == "POST":
        form1 = CharityForm(request.POST)
        if form1.is_valid():
            charity = form1.save(commit=False)
            charity.user = request.user
            charity.save()
            return redirect("/fbcharities")
    else:
        form1 = CharityForm()
    data = {'form1': form1}
    return render(request, "fbcharities/fbnew_charity.html", data)
Exemple #6
0
def new_charity(request):
    if request.method == "POST":
        form1 = CharityForm(request.POST)
        if form1.is_valid():
            if form1.save():
                return redirect("/charities")
    else:
        form1 = CharityForm()
    data = {'form1': form1}
    return render(request, "charities/new_charity.html", data)
Exemple #7
0
def edit_charity(request, charity_id):
    charity = Charity.objects.get(id=charity_id)
    if request.method == "POST":
        form1 = CharityForm(request.POST, instance=charity)
        if form1.is_valid():
            if form1.save():
                return redirect("/charities/{}".format(charity_id))
    else:
        form1 = CharityForm(instance=charity)
    data = {"charity": charity, "form1": form1}
    return render(request, "charities/edit_charity.html", data)
Exemple #8
0
def new_charity(request):
    if request.method == "POST":
        form0 = CharityForm(request.POST)
        if form0.is_valid():
            charity = form0.save(commit=False)
            charity.user = request.user
            charity.save()
            return redirect("/charities")
    else:
        form0 = CharityForm()
    data = {'form0': form0}
    return render(request, "charities/new_charity.html", data)