Changeset - b5cbc3e39e27
[Not reviewed]
0 1 0
Christopher Neugebauer - 8 years ago 2016-09-14 05:00:53
chrisjrn@gmail.com
Renames guided_registration_complete to review
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
registrasion/views.py
Show inline comments
...
 
@@ -191,97 +191,97 @@ def guided_registration(request):
 
                p = _handle_products(request, category, products, prefix)
 
                products_form, discounts, products_handled = p
 

	
 
                section = GuidedRegistrationSection(
 
                    title=category.name,
 
                    description=category.description,
 
                    discounts=discounts,
 
                    form=products_form,
 
                )
 

	
 
                if products:
 
                    # This product category has items to show.
 
                    sections.append(section)
 
                    # Add this to the list of things to show if the form
 
                    # errors.
 
                    request.session[SESSION_KEY].append(category.id)
 

	
 
                    if request.method == "POST" and not products_form.errors:
 
                        # This is only saved if we pass each form with no
 
                        # errors, and if the form actually has products.
 
                        attendee.guided_categories_complete.add(category)
 

	
 
    if sections and request.method == "POST":
 
        for section in sections:
 
            if section.form.errors:
 
                break
 
        else:
 
            attendee.save()
 
            if SESSION_KEY in request.session:
 
                del request.session[SESSION_KEY]
 
            # We've successfully processed everything
 
            return next_step
 

	
 
    data = {
 
        "current_step": current_step,
 
        "sections": sections,
 
        "title": title,
 
        "total_steps": 3,
 
    }
 
    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",
 
        "registrasion/review.html",
 
        {},
 
    )
 

	
 

	
 
@login_required
 
def edit_profile(request):
 
    ''' View for editing an attendee's profile
 

	
 
    The user must be logged in to edit their profile.
 

	
 
    Returns:
 
        redirect or render:
 
            In the case of a ``POST`` request, it'll redirect to ``dashboard``,
 
            or otherwise, it will render ``registrasion/profile_form.html``
 
            with data::
 

	
 
                {
 
                    "form": form,  # Instance of ATTENDEE_PROFILE_FORM.
 
                }
 

	
 
    '''
 

	
 
    form, handled = _handle_profile(request, "profile")
 

	
 
    if handled and not form.errors:
 
        messages.success(
 
            request,
 
            "Your attendee profile was updated.",
 
        )
 
        return redirect("dashboard")
 

	
 
    data = {
 
        "form": form,
 
    }
 
    return render(request, "registrasion/profile_form.html", data)
 

	
 

	
 
def _handle_profile(request, prefix):
 
    ''' Returns a profile form instance, and a boolean which is true if the
 
    form was handled. '''
 
    attendee = people.Attendee.get_instance(request.user)
 

	
 
    try:
 
        profile = attendee.attendeeprofilebase
 
        profile = people.AttendeeProfileBase.objects.get_subclass(
 
            pk=profile.id,
 
        )
 
    except ObjectDoesNotExist:
0 comments (0 inline, 0 general)