示例#1
0
文件: views.py 项目: joshainglis/sadb
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
文件: views.py 项目: joshainglis/sadb
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"})