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}
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"})