Discounts¶
-
class
plata.discount.models.
AppliedDiscount
(*args, **kwargs)[source] Stores an applied discount, so that deletion of discounts does not affect orders.
-
exception
DoesNotExist
-
exception
MultipleObjectsReturned
-
exception
-
class
plata.discount.models.
AppliedDiscountManager
[source] Default manager for the
AppliedDiscount
model-
remaining
(order=None)[source] Calculate remaining discount excl. tax
Can either be used as related manager:
order.applied_discounts.remaining()
or directly:
AppliedDiscount.objects.remaining(order)
-
-
class
plata.discount.models.
Discount
(id, name, type, value, currency, tax_class, config, code, is_active, valid_from, valid_until, allowed_uses, used)[source] -
exception
DoesNotExist
-
exception
MultipleObjectsReturned
-
add_to
(order, recalculate=True)[source] Add discount to passed order
Removes the previous discount if a discount with this code has already been added to the order before.
-
validate
(order)[source] Validate whether this discount can be applied on the given order
-
exception
-
class
plata.discount.models.
DiscountBase
(*args, **kwargs)[source] Base class for discounts and applied discounts
-
CONFIG_OPTIONS
= [(u'all', {u'title': <django.utils.functional.__proxy__ object>}), (u'exclude_sale', {u'orderitem_query': <function <lambda>>, u'title': <django.utils.functional.__proxy__ object>})] You can add and remove options at will, except for ‘all’: This option must always be available, and it cannot have any form fields
-