Browse Source

Add documentation for skip conditions

master
Maik Hoepfel 11 years ago
parent
commit
db62806a9e
2 changed files with 24 additions and 7 deletions
  1. 9
    1
      docs/source/releases/v0.8.rst
  2. 15
    6
      oscar/apps/checkout/session.py

+ 9
- 1
docs/source/releases/v0.8.rst View File

@@ -60,6 +60,14 @@ known.
60 60
 
61 61
 See :ref:`us_site` for more information.
62 62
 
63
+Checkout improvements
64
+---------------------
65
+
66
+The checkout process now skips payment if the order total is zero (e.g. when
67
+ordering free products or using a voucher). As part of that, checkout views
68
+now evaluate *pre-conditions* (as before) and newly introduced
69
+*skip conditions*. This should make customising the checkout flow easier.
70
+
63 71
 Cleanup around shipping methods
64 72
 -------------------------------
65 73
 
@@ -129,7 +137,7 @@ Backwards incompatible changes in 0.8
129 137
   ``Product.recommended_products`` to model products that are loosely related
130 138
   (e.g. used for upselling). ``Product.related_products`` was a
131 139
   third option that sat somewhere in between, and which was not well supported.
132
-  We fear it adds confusion, and in the spirit of keeping Oscare core lean,
140
+  We fear it adds confusion, and in the spirit of keeping Oscar core lean,
133 141
   has been removed. If you're using it, switch to
134 142
   ``Product.recommended_products`` or just add the field back to your
135 143
   custom Product instance and ``ProductForm`` when migrating.

+ 15
- 6
oscar/apps/checkout/session.py View File

@@ -26,14 +26,23 @@ class CheckoutSessionMixin(object):
26 26
     All checkout views subclass this mixin. It ensures that all relevant
27 27
     checkout information is available in the template context.
28 28
     """
29
-    # This should be list of method names that get executed before the normal
30
-    # flow of the view. Each method should check some condition has been met.
31
-    # If not, then an exception is raised that indicates the URL the customer
32
-    # should be redirect to.
29
+
30
+    # A pre-condition is a condition that MUST be met in order for a view
31
+    # to be available. If it isn't then the customer should be redirected
32
+    # to a view *earlier* in the chain.
33
+    # pre_conditions is a list of method names that get executed before the
34
+    # normal flow of the view. Each method should check some condition has been
35
+    # met. If not, then an exception is raised that indicates the URL the
36
+    # customer will be redirected to.
37
+
33 38
     pre_conditions = None
34 39
 
35
-    # Skip conditions check whether the view should be skipped. They work in
36
-    # the same way as pre-conditions.
40
+    # A *skip* condition is a condition that MUST NOT be met in order for a
41
+    # view to be available. If the condition is met, this means the view MUST
42
+    # be skipped and the customer should be redirected to a view *later* in
43
+    # the chain.
44
+    # Skip conditions work similar to pre-conditions, and get evaluated after
45
+    # pre-conditions have been evaluated.
37 46
     skip_conditions = None
38 47
 
39 48
     def dispatch(self, request, *args, **kwargs):

Loading…
Cancel
Save