Skip to content
Browse files

handle invalid form in ajax case

  • Loading branch information...
1 parent c2979b6 commit d5a1c7b4d51bba4709a6dcadfe38316e62fdd6e0 @jtauber jtauber committed
Showing with 8 additions and 0 deletions.
  1. +8 −0 waitinglist/views.py
View
8 waitinglist/views.py
@@ -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 = {

0 comments on commit d5a1c7b

Please sign in to comment.
Something went wrong with that request. Please try again.