|
|
@@ -433,7 +433,11 @@ class Condition(models.Model):
|
|
433
|
433
|
return self
|
|
434
|
434
|
|
|
435
|
435
|
def __unicode__(self):
|
|
436
|
|
- return self.proxy().__unicode__()
|
|
|
436
|
+ return self.proxy().name
|
|
|
437
|
+
|
|
|
438
|
+ @property
|
|
|
439
|
+ def name(self):
|
|
|
440
|
+ return self.description
|
|
437
|
441
|
|
|
438
|
442
|
@property
|
|
439
|
443
|
def description(self):
|
|
|
@@ -553,13 +557,17 @@ class Benefit(models.Model):
|
|
553
|
557
|
raise RuntimeError("Unrecognised benefit type (%s)" % self.type)
|
|
554
|
558
|
|
|
555
|
559
|
def __unicode__(self):
|
|
556
|
|
- desc = self.description
|
|
|
560
|
+ name = self.proxy().name
|
|
557
|
561
|
if self.max_affected_items:
|
|
558
|
|
- desc += ungettext(
|
|
|
562
|
+ name += ungettext(
|
|
559
|
563
|
" (max %d item)",
|
|
560
|
564
|
" (max %d items)",
|
|
561
|
565
|
self.max_affected_items) % self.max_affected_items
|
|
562
|
|
- return desc
|
|
|
566
|
+ return name
|
|
|
567
|
+
|
|
|
568
|
+ @property
|
|
|
569
|
+ def name(self):
|
|
|
570
|
+ return self.description
|
|
563
|
571
|
|
|
564
|
572
|
@property
|
|
565
|
573
|
def description(self):
|
|
|
@@ -816,7 +824,8 @@ class CountCondition(Condition):
|
|
816
|
824
|
"""
|
|
817
|
825
|
_description = _("Basket includes %(count)d item(s) from %(range)s")
|
|
818
|
826
|
|
|
819
|
|
- def __unicode__(self):
|
|
|
827
|
+ @property
|
|
|
828
|
+ def name(self):
|
|
820
|
829
|
return self._description % {
|
|
821
|
830
|
'count': self.value,
|
|
822
|
831
|
'range': unicode(self.range).lower()}
|
|
|
@@ -901,7 +910,8 @@ class CoverageCondition(Condition):
|
|
901
|
910
|
"""
|
|
902
|
911
|
_description = _("Basket includes %(count)d distinct item(s) from %(range)s")
|
|
903
|
912
|
|
|
904
|
|
- def __unicode__(self):
|
|
|
913
|
+ @property
|
|
|
914
|
+ def name(self):
|
|
905
|
915
|
return self._description % {
|
|
906
|
916
|
'count': self.value,
|
|
907
|
917
|
'range': unicode(self.range).lower()}
|
|
|
@@ -1000,7 +1010,8 @@ class ValueCondition(Condition):
|
|
1000
|
1010
|
"""
|
|
1001
|
1011
|
_description = _("Basket includes %(amount)s from %(range)s")
|
|
1002
|
1012
|
|
|
1003
|
|
- def __unicode__(self):
|
|
|
1013
|
+ @property
|
|
|
1014
|
+ def name(self):
|
|
1004
|
1015
|
return self._description % {
|
|
1005
|
1016
|
'amount': currency(self.value),
|
|
1006
|
1017
|
'range': unicode(self.range).lower()}
|
|
|
@@ -1167,7 +1178,8 @@ class PercentageDiscountBenefit(Benefit):
|
|
1167
|
1178
|
"""
|
|
1168
|
1179
|
_description = _("%(value)s%% discount on %(range)s")
|
|
1169
|
1180
|
|
|
1170
|
|
- def __unicode__(self):
|
|
|
1181
|
+ @property
|
|
|
1182
|
+ def name(self):
|
|
1171
|
1183
|
return self._description % {
|
|
1172
|
1184
|
'value': self.value,
|
|
1173
|
1185
|
'range': self.range.name.lower()}
|
|
|
@@ -1214,7 +1226,8 @@ class AbsoluteDiscountBenefit(Benefit):
|
|
1214
|
1226
|
"""
|
|
1215
|
1227
|
_description = _("%(value)s discount on %(range)s")
|
|
1216
|
1228
|
|
|
1217
|
|
- def __unicode__(self):
|
|
|
1229
|
+ @property
|
|
|
1230
|
+ def name(self):
|
|
1218
|
1231
|
return self._description % {
|
|
1219
|
1232
|
'value': currency(self.value),
|
|
1220
|
1233
|
'range': self.range.name.lower()}
|
|
|
@@ -1358,7 +1371,8 @@ class FixedPriceBenefit(Benefit):
|
|
1358
|
1371
|
class MultibuyDiscountBenefit(Benefit):
|
|
1359
|
1372
|
_description = _("Cheapest product from %(range)s is free")
|
|
1360
|
1373
|
|
|
1361
|
|
- def __unicode__(self):
|
|
|
1374
|
+ @property
|
|
|
1375
|
+ def name(self):
|
|
1362
|
1376
|
return self._description % {
|
|
1363
|
1377
|
'range': self.range.name.lower()}
|
|
1364
|
1378
|
|