def submit_site(request): template_name = "example_sites/submit_site.html" if request.method == "POST": form = SiteSubmissionForm(request.POST) if form.is_valid(): form.save() messages.success(request, "Thank you for your submission. It will be reviewed shortly.") return redirect("sites_home") else: form = SiteSubmissionForm() ctx = RequestContext(request, {"form": form}) return render_to_response(template_name, ctx)
def submit_site(request): template_name = "example_sites/submit_site.html" if request.method == "POST": form = SiteSubmissionForm(request.POST) if form.is_valid(): form.save() else: form = SiteSubmissionForm() ctx = RequestContext(request, { "form": form, }) return render_to_response(template_name, ctx)
def submit_site(request): template_name = "example_sites/submit_site.html" if request.method == "POST": form = SiteSubmissionForm(request.POST) if form.is_valid(): form.save() messages.success( request, "Thank you for your submission. It will be reviewed shortly.") return redirect("sites_home") else: form = SiteSubmissionForm() ctx = RequestContext(request, { "form": form, }) return render_to_response(template_name, ctx)