Models

shopkit.price.advanced.models

class shopkit.price.advanced.models.DateRangedPriceMixin(*args, **kwargs)

Bases: django.db.models.base.Model

Base class for a price that is only valid within a given date range.

classmethod get_valid_prices(date=None, *args, **kwargs)

Return valid prices for a specified date, taking the current date if no date is specified.

class shopkit.price.advanced.models.PriceBase(*args, **kwargs)

Bases: shopkit.price.models.PricedItemBase

Abstract base class for price models, exposing a method to get the cheapest price under given conditions.

Be sure to add the proper unique_together contraints to subclasses implementing an actual price model.

classmethod get_cheapest(**kwargs)

Get the cheapest available price under given conditions.

classmethod get_valid_prices(**kwargs)

Get valid prices (as a QuerySet), given certain constraints. By default, this returns all prices available. Where applicable, subclasses might filter this result by:

  • Product
  • Date
  • Quantity
class shopkit.price.advanced.models.ProductPriceMixin(*args, **kwargs)

Bases: django.db.models.base.Model

Represents prices available for a specific product product.

classmethod get_valid_prices(product, *args, **kwargs)

Return valid prices for a specified product

class shopkit.price.advanced.models.QuantifiedPriceMixin(*args, **kwargs)

Bases: shopkit.core.basemodels.QuantizedItemBase

Base class for a price that is only valid above a certain quantity.

classmethod get_valid_prices(quantity=1, *args, **kwargs)

Get valid prices for a given quantity of items. If no quantity is given, 1 is assumed.