Changeset - 9c289acadda4
[Not reviewed]
0 3 1
Christopher Neugebauer - 8 years ago 2016-04-25 00:15:13
chrisjrn@gmail.com
Starts documenting the public views.
4 files changed with 48 insertions and 12 deletions:
0 comments (0 inline, 0 general)
docs/index.rst
Show inline comments
...
 
@@ -23,6 +23,7 @@ Contents:
 
   inventory
 
   payments
 
   for-zookeepr-users
 
   views
 

	
 

	
 
Indices and tables
docs/views.rst
Show inline comments
 
new file 100644
 
Public-facing views
 
===================
 

	
 
.. automodule:: registrasion.views
 
    :members:
registrasion/models/conditions.py
Show inline comments
...
 
@@ -392,8 +392,8 @@ class ProductFlag(EnablingConditionBase):
 
    ''' The condition is met because a specific product is purchased.
 

	
 
    Attributes:
 
    enabling_products ([inventory.Product, ...]): The products that cause this
 
        condition to be met.
 
        enabling_products ([inventory.Product, ...]): The products that cause
 
            this condition to be met.
 
    '''
 

	
 
    class Meta:
registrasion/views.py
Show inline comments
 
import sys
 

	
 
from registrasion import forms
 
from registrasion import util
 
from registrasion.models import commerce
 
from registrasion.models import inventory
 
from registrasion.models import people
...
 
@@ -24,7 +25,7 @@ from django.shortcuts import redirect
 
from django.shortcuts import render
 

	
 

	
 
GuidedRegistrationSection = namedtuple(
 
_GuidedRegistrationSection = namedtuple(
 
    "GuidedRegistrationSection",
 
    (
 
        "title",
...
 
@@ -33,9 +34,26 @@ GuidedRegistrationSection = namedtuple(
 
        "form",
 
    )
 
)
 
GuidedRegistrationSection.__new__.__defaults__ = (
 
    (None,) * len(GuidedRegistrationSection._fields)
 
)
 

	
 

	
 
@util.all_arguments_optional
 
class GuidedRegistrationSection(_GuidedRegistrationSection):
 
    ''' Represents a section of a guided registration page.
 

	
 
    Attributes:
 
        title (str): The title of the section.
 

	
 
        discounts ([registrasion.contollers.discount.DiscountAndQuantity, ...]):
 
            A list of discount objects that are available in the section. You
 
            can display ``.clause`` to show what the discount applies to, and
 
            ``.quantity`` to display the number of times that discount can be
 
            applied.
 

	
 
        description (str): A description of the section.
 

	
 
        form (forms.Form): A form to display.
 
    '''
 
    pass
 

	
 

	
 
def get_form(name):
...
 
@@ -46,13 +64,25 @@ def get_form(name):
 

	
 

	
 
@login_required
 
def guided_registration(request, page_id=0):
 
    ''' Goes through the registration process in order,
 
    making sure user sees all valid categories.
 
def guided_registration(request):
 
    ''' Goes through the registration process in order, making sure user sees
 
    all valid categories.
 

	
 
    The user must be logged in to see this view.
 

	
 
    Returns:
 
        render: Renders ``registrasion/guided_registration.html``,
 
            with the following data::
 

	
 
                {
 
                    "current_step": int(),  # The current step in the
 
                                            # registration
 
                    "sections": sections,   # A list of
 
                                            # GuidedRegistrationSections
 
                    "title": str(),         # The title of the page
 
                    "total_steps": int(),   # The total number of steps
 
                }
 

	
 
    WORK IN PROGRESS: the finalised version of this view will allow
 
    grouping of categories into a specific page. Currently, it just goes
 
    through each category one by one
 
    '''
 

	
 
    SESSION_KEY = "guided_registration_categories"
0 comments (0 inline, 0 general)