Skip to content

Commit

Permalink
handle invalid form in ajax case
Browse files Browse the repository at this point in the history
  • Loading branch information
jtauber committed Jan 2, 2013
1 parent c2979b6 commit d5a1c7b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions waitinglist/views.py
Expand Up @@ -30,6 +30,14 @@ def list_signup(request, post_save_redirect=None):
if not post_save_redirect.startswith("/"):
post_save_redirect = reverse(post_save_redirect)
return redirect(post_save_redirect)
elif request.is_ajax():
data = {
"html": render_to_string("waitinglist/_list_signup.html", {
"form": form,
}, context_instance=RequestContext(request))
}
return HttpResponse(json.dumps(data), mimetype="application/json")

else:
form = WaitingListEntryForm()
ctx = {
Expand Down

0 comments on commit d5a1c7b

Please sign in to comment.