瀏覽代碼

Add documentation for skip conditions

master
Maik Hoepfel 11 年之前
父節點
當前提交
db62806a9e
共有 2 個檔案被更改,包括 24 行新增7 行删除
  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 查看文件

60
 
60
 
61
 See :ref:`us_site` for more information.
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
 Cleanup around shipping methods
71
 Cleanup around shipping methods
64
 -------------------------------
72
 -------------------------------
65
 
73
 
129
   ``Product.recommended_products`` to model products that are loosely related
137
   ``Product.recommended_products`` to model products that are loosely related
130
   (e.g. used for upselling). ``Product.related_products`` was a
138
   (e.g. used for upselling). ``Product.related_products`` was a
131
   third option that sat somewhere in between, and which was not well supported.
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
   has been removed. If you're using it, switch to
141
   has been removed. If you're using it, switch to
134
   ``Product.recommended_products`` or just add the field back to your
142
   ``Product.recommended_products`` or just add the field back to your
135
   custom Product instance and ``ProductForm`` when migrating.
143
   custom Product instance and ``ProductForm`` when migrating.

+ 15
- 6
oscar/apps/checkout/session.py 查看文件

26
     All checkout views subclass this mixin. It ensures that all relevant
26
     All checkout views subclass this mixin. It ensures that all relevant
27
     checkout information is available in the template context.
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
     pre_conditions = None
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
     skip_conditions = None
46
     skip_conditions = None
38
 
47
 
39
     def dispatch(self, request, *args, **kwargs):
48
     def dispatch(self, request, *args, **kwargs):

Loading…
取消
儲存