Browse Source

Rename demo offers module to be the same as sandbox

(So the fixture loads in both envs).
master
David Winterbottom 13 years ago
parent
commit
bd5b9c1547
1 changed files with 19 additions and 0 deletions
  1. 19
    0
      sites/demo/apps/offers.py

sites/demo/apps/custom_offers.py → sites/demo/apps/offers.py View File

@@ -27,3 +27,22 @@ class BasketOwnerCalledBarry(models.Condition):
27 27
 
28 28
     def consume_items(self, basket, affected_lines):
29 29
         return
30
+
31
+
32
+class ChangesOwnerName(models.Benefit):
33
+
34
+    class Meta:
35
+        proxy = True
36
+
37
+    def apply(self, basket, condition, offer=None):
38
+        condition.consume_items(basket, ())
39
+        return models.PostOrderAction(
40
+            "You will have your name changed to Barry!")
41
+
42
+    def apply_deferred(self, basket):
43
+        basket.owner.first_name = "Barry"
44
+        basket.owner.save()
45
+
46
+    @property
47
+    def description(self):
48
+        return "Changes owners name"

Loading…
Cancel
Save