Source code for oscar.apps.offer.models

from oscar.core.loading import is_model_registered
from oscar.apps.offer.results import (
    BasketDiscount, ShippingDiscount, PostOrderAction,
    SHIPPING_DISCOUNT, ZERO_DISCOUNT)
from oscar.apps.offer.abstract_models import (
    AbstractBenefit, AbstractCondition, AbstractConditionalOffer,
    AbstractRange, AbstractRangeProduct, AbstractRangeProductFileUpload)


__all__ = [
    'BasketDiscount', 'ShippingDiscount', 'PostOrderAction',
    'SHIPPING_DISCOUNT', 'ZERO_DISCOUNT'
]


if not is_model_registered('offer', 'ConditionalOffer'):
[docs] class ConditionalOffer(AbstractConditionalOffer): pass
__all__.append('ConditionalOffer') if not is_model_registered('offer', 'Benefit'):
[docs] class Benefit(AbstractBenefit): pass
__all__.append('Benefit') if not is_model_registered('offer', 'Condition'):
[docs] class Condition(AbstractCondition): pass
__all__.append('Condition') if not is_model_registered('offer', 'Range'):
[docs] class Range(AbstractRange): pass
__all__.append('Range') if not is_model_registered('offer', 'RangeProduct'):
[docs] class RangeProduct(AbstractRangeProduct): pass
__all__.append('RangeProduct') if not is_model_registered('offer', 'RangeProductFileUpload'):
[docs] class RangeProductFileUpload(AbstractRangeProductFileUpload): pass
__all__.append('RangeProductFileUpload') # Import the benefits and the conditions. Required after initializing the # parent models to allow overriding them from oscar.apps.offer.benefits import * # noqa from oscar.apps.offer.conditions import * # noqa from oscar.apps.offer.benefits import __all__ as benefit_classes # noqa from oscar.apps.offer.conditions import __all__ as condition_classes # noqa __all__.extend(benefit_classes) __all__.extend(condition_classes)