Пример #1
0
def json_aid_form(request):
    form = AidForm(request.POST or None)
    if form.is_valid():
        form.save()
        return {"success": True}

    form_html = render_crispy_form(form)
    return {"success": False, "form_html": form_html}
Пример #2
0
def aid_form(request):
    if request.method == "POST":
        form = AidForm(request.POST, request.FILES)
        if form.is_valid():
            form.save()
            form = AidForm()
            # HttpResponseRedirect('/aid_form/')
    else:
        form = AidForm()
    return render(request, "aid_form.html", {"form": form, "title": "Add Aids and Equipment"})