From 640db7e3dced4514f49e73bfc5978ec71e7581d5 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Wed, 14 Sep 2016 14:59:01 +1000 Subject: [PATCH] Replaces the final stage of guided registration with a review page, which shows after adding anything to your cart. Fixes #87 --- registrasion/urls.py | 14 ++++++++------ registrasion/views.py | 28 ++++++++++++++++++---------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/registrasion/urls.py b/registrasion/urls.py index ac7faace..4d746388 100644 --- a/registrasion/urls.py +++ b/registrasion/urls.py @@ -4,16 +4,17 @@ from django.conf.urls import include from django.conf.urls import url from .views import ( - product_category, + amend_registration, checkout, credit_note, - invoice, - manual_payment, - refund, - invoice_access, edit_profile, guided_registration, - amend_registration, + invoice, + invoice_access, + manual_payment, + product_category, + refund, + review, ) @@ -33,6 +34,7 @@ public = [ name="invoice_access"), url(r"^profile$", edit_profile, name="attendee_edit"), url(r"^register$", guided_registration, name="guided_registration"), + url(r"^review$", review, name="review"), url(r"^register/([0-9]+)$", guided_registration, name="guided_registration"), ] diff --git a/registrasion/views.py b/registrasion/views.py index 704b05c2..f272593a 100644 --- a/registrasion/views.py +++ b/registrasion/views.py @@ -98,11 +98,7 @@ def guided_registration(request): attendee = people.Attendee.get_instance(request.user) if attendee.completed_registration: - return render( - request, - "registrasion/guided_registration_complete.html", - {}, - ) + return redirect(review) # Step 1: Fill in a badge and collect a voucher code try: @@ -234,6 +230,17 @@ def guided_registration(request): return render(request, "registrasion/guided_registration.html", data) +@login_required +def review(request): + ''' View for the review page. ''' + + return render( + request, + "registrasion/guided_registration_complete.html", + {}, + ) + + @login_required def edit_profile(request): ''' View for editing an attendee's profile @@ -370,11 +377,12 @@ def product_category(request, category_id): if request.POST and not voucher_handled and not products_form.errors: # Only return to the dashboard if we didn't add a voucher code # and if there's no errors in the products form - messages.success( - request, - "Your reservations have been updated.", - ) - return redirect("dashboard") + if products_form.has_changed(): + messages.success( + request, + "Your reservations have been updated.", + ) + return redirect(review) data = { "category": category,