shuup.campaigns.models package

Submodules

shuup.campaigns.models.basket_conditions module

class shuup.campaigns.models.basket_conditions.BasketCondition(id, polymorphic_ctype, active)[source]

Bases: polymorphic.models.PolymorphicModel

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
baskettotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalProductAmountCondition

baskettotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalAmountCondition

baskettotalundiscountedproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalUndiscountedProductAmountCondition

basketmaxtotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalProductAmountCondition

basketmaxtotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalAmountCondition

productsinbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ProductsInBasketCondition

contactgroupbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactGroupBasketCondition

contactbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactBasketCondition

categoryproductsbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.CategoryProductsBasketCondition

hourbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.HourBasketCondition

childrenproductcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ChildrenProductCondition

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
baskettotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalProductAmountCondition

baskettotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalAmountCondition

baskettotalundiscountedproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalUndiscountedProductAmountCondition

basketmaxtotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalProductAmountCondition

basketmaxtotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalAmountCondition

productsinbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ProductsInBasketCondition

contactgroupbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactGroupBasketCondition

contactbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactBasketCondition

categoryproductsbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.CategoryProductsBasketCondition

hourbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.HourBasketCondition

childrenproductcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ChildrenProductCondition

model = None
active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name = 'Basket condition'
matches(basket, lines)[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

basketmaxtotalamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

basketmaxtotalproductamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

baskettotalamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

baskettotalproductamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

baskettotalundiscountedproductamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

campaign

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

categoryproductsbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

childrenproductcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

contactbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

contactgroupbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

hourbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productsinbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class shuup.campaigns.models.basket_conditions.BasketTotalProductAmountCondition(id, polymorphic_ctype, active, basketcondition_ptr, product_count)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • product_count (DecimalField) – Product count in basket

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • product_count (DecimalField) – Product count in basket
identifier = 'basket_product_condition'
name = 'Basket product count'
product_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(basket, lines)[source]
description
value
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.BasketTotalAmountCondition(id, polymorphic_ctype, active, basketcondition_ptr, amount_value)[source]

Bases: shuup.utils.properties.MoneyPropped, shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
identifier = 'basket_amount_condition'
name = 'Basket total value'
amount

Property for Price object.

Similar to MoneyProperty, but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

amount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(basket, lines)[source]
description
value
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.BasketTotalUndiscountedProductAmountCondition(id, polymorphic_ctype, active, basketcondition_ptr, amount_value)[source]

Bases: shuup.utils.properties.MoneyPropped, shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
identifier = 'basket_amount_condition_undiscounted'
name = 'Undiscounted basket total value'
amount

Property for Price object.

Similar to MoneyProperty, but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

amount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(basket, lines)[source]
description
value
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.BasketMaxTotalProductAmountCondition(id, polymorphic_ctype, active, basketcondition_ptr, product_count)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • product_count (DecimalField) – Maximum product count in basket

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • product_count (DecimalField) – Maximum product count in basket
identifier = 'basket_max_product_condition'
name = 'Basket maximum product count'
product_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(basket, lines)[source]
description
value
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.BasketMaxTotalAmountCondition(id, polymorphic_ctype, active, basketcondition_ptr, amount_value)[source]

Bases: shuup.utils.properties.MoneyPropped, shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
identifier = 'basket_max_amount_condition'
name = 'Basket maximum total value'
amount

Property for Price object.

Similar to MoneyProperty, but also has includes_tax field.

Operaters with TaxfulPrice and TaxlessPrice objects.

amount_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(basket, lines)[source]
description
value
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.ComparisonOperator[source]

Bases: enumfields.enums.Enum

An enumeration.

EQUALS = 0
GTE = 1
class shuup.campaigns.models.basket_conditions.ProductsInBasketCondition(id, polymorphic_ctype, active, basketcondition_ptr, operator, quantity)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • operator (EnumIntegerField) – Operator
  • quantity (PositiveIntegerField) – Quantity
  • products (ManyToManyField to shuup.core.models.Product) – Products

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • operator (EnumIntegerField) – Operator
  • quantity (PositiveIntegerField) – Quantity
  • products (ManyToManyField to shuup.core.models.Product) – Products
identifier = 'basket_products_condition'
name = 'Products in basket'
model

alias of Product

operator

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

products

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

matches(basket, lines)[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_operator_display(*, field=<enumfields.fields.EnumIntegerField: operator>)
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.ContactGroupBasketCondition(id, polymorphic_ctype, active, basketcondition_ptr)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
model

alias of ContactGroup

identifier = 'basket_contact_group_condition'
name = 'Contact Group'
contact_groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

matches(basket, lines=[])[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.ContactBasketCondition(id, polymorphic_ctype, active, basketcondition_ptr)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
model

alias of Contact

identifier = 'basket_contact_condition'
name = 'Contact'
contacts

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

matches(basket, lines=[])[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.CategoryProductsBasketCondition(id, polymorphic_ctype, active, basketcondition_ptr, operator, quantity)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • operator (EnumIntegerField) – Operator
  • quantity (PositiveIntegerField) – Quantity
  • categories (ManyToManyField to shuup.core.models.Category) – Categories
  • excluded_categories (ManyToManyField to shuup.core.models.Category) – If the customer has even a single product in the basket from these categories this rule won’t match thus the campaign cannot be applied to the basket.

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • operator (EnumIntegerField) – Operator
  • quantity (PositiveIntegerField) – Quantity
  • categories (ManyToManyField to shuup.core.models.Category) – Categories
  • excluded_categories (ManyToManyField to shuup.core.models.Category) – If the customer has even a single product in the basket from these categories this rule won’t match thus the campaign cannot be applied to the basket.
model

alias of Category

identifier = 'basket_category_condition'
name = 'Category products in basket'
operator

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

categories

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

excluded_categories

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

matches(basket, lines)[source]
description
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_operator_display(*, field=<enumfields.fields.EnumIntegerField: operator>)
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.HourBasketCondition(id, polymorphic_ctype, active, basketcondition_ptr, hour_start, hour_end, days)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • hour_start (TimeField) – 12pm is considered noon and 12am as midnight.
  • hour_end (TimeField) – 12pm is considered noon and 12am as midnight. End time is not considered match.
  • days (CharField) – Days

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • basketcondition_ptr (OneToOneField to shuup.campaigns.models.basket_conditions.BasketCondition) – Basketcondition ptr
  • hour_start (TimeField) – 12pm is considered noon and 12am as midnight.
  • hour_end (TimeField) – 12pm is considered noon and 12am as midnight. End time is not considered match.
  • days (CharField) – Days
identifier = 'hour_condition'
name = 'Day and hour'
hour_start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hour_end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

days

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(basket, lines)[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_conditions.ChildrenProductCondition(id, polymorphic_ctype, active, basketcondition_ptr, product)[source]

Bases: shuup.campaigns.models.basket_conditions.BasketCondition

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
exception DoesNotExist

Bases: shuup.campaigns.models.basket_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_conditions.MultipleObjectsReturned

basketcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
product_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier = 'is_product_child_condition'
name = 'Product Variation Child'
model

alias of Product

product

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

matches(basket, lines)[source]
description
values

shuup.campaigns.models.basket_effects module

class shuup.campaigns.models.basket_effects.BasketDiscountEffect(id, polymorphic_ctype, campaign)[source]

Bases: shuup.core.models.PolymorphicShuupModel

Parameters:
basketdiscountamount_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountAmount

basketdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountPercentage

discountpercentagefromundiscounted_set

OneToOneRel to shuup.campaigns.models.basket_effects.DiscountPercentageFromUndiscounted

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
basketdiscountamount_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountAmount

basketdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountPercentage

discountpercentagefromundiscounted_set

OneToOneRel to shuup.campaigns.models.basket_effects.DiscountPercentageFromUndiscounted

identifier = None
model = None
admin_form_class = None
campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

apply_for_basket(order_source)[source]

Applies the effect based on given order_source

Returns:amount of discount to accumulate for the product
Return type:Price
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

basketdiscountamount

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

basketdiscountpercentage

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

campaign_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discountpercentagefromundiscounted

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_effects.BasketDiscountAmount(id, polymorphic_ctype, campaign, basketdiscounteffect_ptr, discount_amount)[source]

Bases: shuup.campaigns.models.basket_effects.BasketDiscountEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'discount_amount_effect'
name = 'Discount amount value'
discount_amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
value
apply_for_basket(order_source)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.basket_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_effects.MultipleObjectsReturned

basketdiscounteffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketdiscounteffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_effects.BasketDiscountPercentage(id, polymorphic_ctype, campaign, basketdiscounteffect_ptr, discount_percentage)[source]

Bases: shuup.campaigns.models.basket_effects.BasketDiscountEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'discount_percentage_effect'
name = 'Discount amount percentage'
admin_form_class

alias of PercentageField

discount_percentage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
value
apply_for_basket(order_source)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.basket_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_effects.MultipleObjectsReturned

basketdiscounteffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketdiscounteffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_effects.DiscountPercentageFromUndiscounted(id, polymorphic_ctype, campaign, basketdiscounteffect_ptr, discount_percentage)[source]

Bases: shuup.campaigns.models.basket_effects.BasketDiscountEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'undiscounted_percentage_effect'
name = 'Discount amount percentage from undiscounted amount'
admin_form_class

alias of PercentageField

discount_percentage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
exception DoesNotExist

Bases: shuup.campaigns.models.basket_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_effects.MultipleObjectsReturned

basketdiscounteffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketdiscounteffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
value
apply_for_basket(order_source)[source]

shuup.campaigns.models.basket_line_effects module

class shuup.campaigns.models.basket_line_effects.BasketLineEffect(id, polymorphic_ctype, campaign)[source]

Bases: shuup.core.models.PolymorphicShuupModel

Parameters:
freeproductline_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.FreeProductLine

discountfromproduct_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromProduct

discountfromcategoryproducts_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromCategoryProducts

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
freeproductline_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.FreeProductLine

discountfromproduct_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromProduct

discountfromcategoryproducts_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromCategoryProducts

identifier = None
model = None
admin_form_class = None
campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

get_discount_lines(order_source, original_lines, supplier)[source]

Applies the effect based on given order_source

Returns:amount of discount to accumulate for the product
Return type:Iterable[shuup.core.order_creator.SourceLine]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

campaign_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discountfromcategoryproducts

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

discountfromproduct

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

freeproductline

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_line_effects.FreeProductLine(id, polymorphic_ctype, campaign, basketlineeffect_ptr, quantity)[source]

Bases: shuup.campaigns.models.basket_line_effects.BasketLineEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'free_product_line_effect'
model

alias of Product

name = 'Free Product(s)'
quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

products

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

description
values
get_discount_lines(order_source, original_lines, supplier)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.basket_line_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_line_effects.MultipleObjectsReturned

basketlineeffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketlineeffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_line_effects.DiscountFromProduct(id, polymorphic_ctype, campaign, basketlineeffect_ptr, per_line_discount, discount_amount)[source]

Bases: shuup.campaigns.models.basket_line_effects.BasketLineEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'discount_from_product_line_effect'
model

alias of Product

name = 'Discount from Product'
per_line_discount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

products

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

description
get_discount_lines(order_source, original_lines, supplier)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.basket_line_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_line_effects.MultipleObjectsReturned

basketlineeffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketlineeffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.basket_line_effects.DiscountFromCategoryProducts(id, polymorphic_ctype, campaign, basketlineeffect_ptr, discount_amount, discount_percentage, category)[source]

Bases: shuup.campaigns.models.basket_line_effects.BasketLineEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'discount_from_category_products_line_effect'
model

alias of Category

name = 'Discount from Category products'
discount_amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discount_percentage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

category

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

description
get_discount_lines(order_source, original_lines, supplier)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.basket_line_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.basket_line_effects.MultipleObjectsReturned

basketlineeffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

basketlineeffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

category_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False

shuup.campaigns.models.cache module

class shuup.campaigns.models.cache.CatalogFilterCachedShopProduct(id, filter, shop_product)[source]

Bases: django.db.models.base.Model

Parameters:
filter

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

shop_product

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

filter_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
shop_product_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shuup.campaigns.models.campaigns module

class shuup.campaigns.models.campaigns.CampaignType[source]

Bases: enumfields.enums.Enum

An enumeration.

CATALOG = 1
BASKET = 2
class shuup.campaigns.models.campaigns.CampaignQueryset(model=None, query=None, using=None, hints=None)[source]

Bases: django.db.models.query.QuerySet

available(shop=None)[source]
class shuup.campaigns.models.campaigns.Campaign(*args, **kwargs)[source]

Bases: shuup.utils.properties.MoneyPropped, parler.models.TranslatableModel

Parameters:
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the campaign is active.
  • name (CharField) – The name for this campaign.
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • active (BooleanField) – Enable this if the campaign is currently active. Please also set a start and an end date.
  • start_datetime (DateTimeField) – The date and time the campaign starts. This is only applicable if the campaign is marked as active.
  • end_datetime (DateTimeField) – The date and time the campaign ends. This is only applicable if the campaign is marked as active.
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
admin_url_suffix = None
shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_datetime

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_datetime

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects
class Meta[source]

Bases: object

abstract = False
verbose_name = 'Campaign'
verbose_name_plural = 'Campaigns'
save(*args, **kwargs)[source]
is_available()[source]
type
created_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
modified_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shop_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.campaigns.models.campaigns.CatalogCampaign(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on)[source]

Bases: shuup.campaigns.models.campaigns.Campaign

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the campaign is active.
  • name (CharField) – The name for this campaign.
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • active (BooleanField) – Enable this if the campaign is currently active. Please also set a start and an end date.
  • start_datetime (DateTimeField) – The date and time the campaign starts. This is only applicable if the campaign is marked as active.
  • end_datetime (DateTimeField) – The date and time the campaign ends. This is only applicable if the campaign is marked as active.
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
  • conditions (ManyToManyField to shuup.campaigns.models.context_conditions.ContextCondition) – Conditions
  • filters (ManyToManyField to shuup.campaigns.models.catalog_filters.CatalogFilter) – Filters
  • public_name (CharField) – (Translatable) The campaign name to show in the store front.
translations

ManyToOneRel to shuup.campaigns.models.campaigns.CatalogCampaignTranslation

log_entries

ManyToOneRel to shuup.campaigns.models.campaigns.CatalogCampaignLogEntry

effects

ManyToOneRel to shuup.campaigns.models.product_effects.ProductDiscountEffect

admin_url_suffix = 'catalog_campaign'
conditions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

filters

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

translations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

save(*args, **kwargs)[source]
rules_match(context, shop_product, matching_catalog_filters, matching_context_conditions)[source]
classmethod get_for_product(shop_product)[source]
classmethod get_matching(context, shop_product)[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

effects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

log_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

public_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

class shuup.campaigns.models.campaigns.BasketCampaign(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on, basket_line_text, coupon, supplier)[source]

Bases: shuup.campaigns.models.campaigns.Campaign

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the campaign is active.
  • name (CharField) – The name for this campaign.
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • active (BooleanField) – Enable this if the campaign is currently active. Please also set a start and an end date.
  • start_datetime (DateTimeField) – The date and time the campaign starts. This is only applicable if the campaign is marked as active.
  • end_datetime (DateTimeField) – The date and time the campaign ends. This is only applicable if the campaign is marked as active.
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
  • basket_line_text (CharField) – This text will be shown in a basket.
  • coupon (OneToOneField to shuup.campaigns.models.campaigns.Coupon) – Coupon
  • supplier (ForeignKey to shuup.core.models.Supplier) – When set, this campaign will match only products from the selected supplier. Rules and Effects will also be restricted to include only the products of this supplier.
  • conditions (ManyToManyField to shuup.campaigns.models.basket_conditions.BasketCondition) – Conditions
  • public_name (CharField) – (Translatable) The campaign name to show in the store front.
discount_effects

ManyToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountEffect

line_effects

ManyToOneRel to shuup.campaigns.models.basket_line_effects.BasketLineEffect

translations

ManyToOneRel to shuup.campaigns.models.campaigns.BasketCampaignTranslation

log_entries

ManyToOneRel to shuup.campaigns.models.campaigns.BasketCampaignLogEntry

admin_url_suffix = 'basket_campaign'
basket_line_text

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

conditions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

coupon

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

supplier

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

translations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

save(*args, **kwargs)[source]
classmethod get_for_product(shop_product)[source]
classmethod get_matching(basket, lines)[source]
rules_match(basket, lines)[source]

Check if basket rules match.

They will not match if: 1) The campaign is not active 2) The campaign has attached coupon,

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/campaigns/models/campaigns.py:docstring of shuup.campaigns.models.campaigns.BasketCampaign.rules_match, line 6)

Unexpected indentation.
which doesn’t match or is not active

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/campaigns/models/campaigns.py:docstring of shuup.campaigns.models.campaigns.BasketCampaign.rules_match, line 7)

Block quote ends without a blank line; unexpected unindent.
  1. Any of the attached rules don’t match
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
coupon_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

discount_effects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

line_effects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

log_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

public_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

supplier_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.campaigns.models.campaigns.CouponUsage(id, coupon, order, created_by, modified_by, created_on, modified_on)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • coupon (ForeignKey to shuup.campaigns.models.campaigns.Coupon) – Coupon
  • order (ForeignKey to shuup.core.models.Order) – Order
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
log_entries

ManyToOneRel to shuup.campaigns.models.campaigns.CouponUsageLogEntry

coupon

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

order

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod add_usage(order, coupon)[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
coupon_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

log_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
order_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.campaigns.models.campaigns.Coupon(id, code, usage_limit_customer, usage_limit, active, shop, supplier, created_by, modified_by, created_on, modified_on)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • code (CharField) – Code
  • usage_limit_customer (PositiveIntegerField) – Limit the amount of usages per a single customer.
  • usage_limit (PositiveIntegerField) – Set the absolute limit of usages for this coupon. If the limit is zero (0), coupon can’t be used.
  • active (BooleanField) – Is active
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the coupon is active.
  • supplier (ForeignKey to shuup.core.models.Supplier) – Supplier
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
campaign

OneToOneRel to shuup.campaigns.models.campaigns.BasketCampaign

usages

ManyToOneRel to shuup.campaigns.models.campaigns.CouponUsage

log_entries

ManyToOneRel to shuup.campaigns.models.campaigns.CouponLogEntry

admin_url_suffix = 'coupon'
name_field = 'code'
search_fields = ['code']
code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

usage_limit_customer

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

usage_limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

supplier

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(**kwargs)[source]
classmethod generate_code(length=6)[source]
exhausted
attached
attach_to_campaign(campaign)[source]
classmethod is_usable(code, customer)[source]
can_use_code(customer)[source]

Check if customer can use the code.

Parameters:customer (Contact or None) –
Return type:True|False
use(order)[source]
increase_customer_usage_limit_by(amount)[source]
increase_usage_limit_by(amount)[source]
has_been_used(usage_count=1)[source]

See if code was already used the number of maximum times given

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
campaign

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

created_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

log_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
shop_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

supplier_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

usages

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class shuup.campaigns.models.campaigns.CatalogCampaignLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shuup.utils.analog.BaseLogEntry

Parameters:
  • id (AutoField) – Id
  • created_on (DateTimeField) – Created on
  • user (ForeignKey to django.contrib.auth.models.User) – User
  • message (CharField) – Message
  • identifier (CharField) – Identifier
  • kind (EnumIntegerField) – Log entry kind
  • extra (JSONField) – Extra data
  • target (ForeignKey to shuup.campaigns.models.campaigns.CatalogCampaign) – Target
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

extra

A placeholder class that provides a way to set the attribute on the model.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kind

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

logged_model

alias of CatalogCampaign

objects = <django.db.models.manager.Manager object>
target

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

target_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

class shuup.campaigns.models.campaigns.BasketCampaignLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shuup.utils.analog.BaseLogEntry

Parameters:
  • id (AutoField) – Id
  • created_on (DateTimeField) – Created on
  • user (ForeignKey to django.contrib.auth.models.User) – User
  • message (CharField) – Message
  • identifier (CharField) – Identifier
  • kind (EnumIntegerField) – Log entry kind
  • extra (JSONField) – Extra data
  • target (ForeignKey to shuup.campaigns.models.campaigns.BasketCampaign) – Target
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

extra

A placeholder class that provides a way to set the attribute on the model.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kind

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

logged_model

alias of BasketCampaign

objects = <django.db.models.manager.Manager object>
target

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

target_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

class shuup.campaigns.models.campaigns.CouponLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shuup.utils.analog.BaseLogEntry

Parameters:
  • id (AutoField) – Id
  • created_on (DateTimeField) – Created on
  • user (ForeignKey to django.contrib.auth.models.User) – User
  • message (CharField) – Message
  • identifier (CharField) – Identifier
  • kind (EnumIntegerField) – Log entry kind
  • extra (JSONField) – Extra data
  • target (ForeignKey to shuup.campaigns.models.campaigns.Coupon) – Target
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

extra

A placeholder class that provides a way to set the attribute on the model.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kind

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

logged_model

alias of Coupon

objects = <django.db.models.manager.Manager object>
target

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

target_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

class shuup.campaigns.models.campaigns.CouponUsageLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shuup.utils.analog.BaseLogEntry

Parameters:
  • id (AutoField) – Id
  • created_on (DateTimeField) – Created on
  • user (ForeignKey to django.contrib.auth.models.User) – User
  • message (CharField) – Message
  • identifier (CharField) – Identifier
  • kind (EnumIntegerField) – Log entry kind
  • extra (JSONField) – Extra data
  • target (ForeignKey to shuup.campaigns.models.campaigns.CouponUsage) – Target
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

extra

A placeholder class that provides a way to set the attribute on the model.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kind

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

logged_model

alias of CouponUsage

objects = <django.db.models.manager.Manager object>
target

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

target_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

class shuup.campaigns.models.campaigns.BasketCampaignTranslation(id, language_code, public_name, master)

Bases: parler.models.TranslatedFieldsModel

Parameters:
  • id (AutoField) – Id
  • language_code (HideChoicesCharField) – Language
  • public_name (CharField) – The campaign name to show in the store front.
  • master (TranslationsForeignKey to shuup.campaigns.models.campaigns.BasketCampaign) – Master
exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shuup.campaigns.models.campaigns.DoesNotExist, shuup.campaigns.models.campaigns.DoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

master

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

master_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
public_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.campaigns.models.campaigns.CatalogCampaignTranslation(id, language_code, public_name, master)

Bases: parler.models.TranslatedFieldsModel

Parameters:
  • id (AutoField) – Id
  • language_code (HideChoicesCharField) – Language
  • public_name (CharField) – The campaign name to show in the store front.
  • master (TranslationsForeignKey to shuup.campaigns.models.campaigns.CatalogCampaign) – Master
exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shuup.campaigns.models.campaigns.DoesNotExist, shuup.campaigns.models.campaigns.DoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

master

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

master_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
public_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shuup.campaigns.models.catalog_filters module

class shuup.campaigns.models.catalog_filters.CatalogFilter(id, polymorphic_ctype, active)[source]

Bases: polymorphic.models.PolymorphicModel

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

producttypefilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductTypeFilter

productfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductFilter

categoryfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.CategoryFilter

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

producttypefilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductTypeFilter

productfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductFilter

categoryfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.CategoryFilter

model = None
identifier = 'base_catalog_filter'
name = 'Base Catalog Filter'
active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

filter_queryset(queryset)[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cached_shop_products

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

campaign

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

categoryfilter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productfilter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

producttypefilter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class shuup.campaigns.models.catalog_filters.ProductTypeFilter(id, polymorphic_ctype, active, catalogfilter_ptr)[source]

Bases: shuup.campaigns.models.catalog_filters.CatalogFilter

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

model

alias of ProductType

identifier = 'product_type_filter'
name = 'Product type'
product_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_matching_shop_products()[source]
matches(shop_product)[source]
filter_queryset(queryset)[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.catalog_filters.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.catalog_filters.MultipleObjectsReturned

catalogfilter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

catalogfilter_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.catalog_filters.ProductFilter(id, polymorphic_ctype, active, catalogfilter_ptr)[source]

Bases: shuup.campaigns.models.catalog_filters.CatalogFilter

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

model

alias of Product

identifier = 'product_filter'
name = 'Product'
products

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_matching_shop_products()[source]
matches(shop_product)[source]
filter_queryset(queryset)[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.catalog_filters.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.catalog_filters.MultipleObjectsReturned

catalogfilter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

catalogfilter_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.catalog_filters.CategoryFilter(id, polymorphic_ctype, active, catalogfilter_ptr)[source]

Bases: shuup.campaigns.models.catalog_filters.CatalogFilter

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

model

alias of Category

identifier = 'category_filter'
name = 'Product Category'
categories

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_matching_shop_products()[source]
matches(shop_product)[source]
filter_queryset(queryset)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.catalog_filters.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.catalog_filters.MultipleObjectsReturned

catalogfilter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

catalogfilter_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
values

shuup.campaigns.models.contact_group_sales_ranges module

class shuup.campaigns.models.contact_group_sales_ranges.SalesRangeQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: django.db.models.query.QuerySet

active(shop)[source]
class shuup.campaigns.models.contact_group_sales_ranges.ContactGroupSalesRange(id, group, shop, min_value, max_value)[source]

Bases: django.db.models.base.Model

Parameters:
group

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

min_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

max_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.ManagerFromSalesRangeQuerySet object>
save(*args, **kwargs)[source]
clean()[source]
is_active()[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

group_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shop_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

shuup.campaigns.models.context_conditions module

class shuup.campaigns.models.context_conditions.ContextCondition(id, polymorphic_ctype, active)[source]

Bases: polymorphic.models.PolymorphicModel

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
contactgroupcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactGroupCondition

contactcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactCondition

hourcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.HourCondition

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
contactgroupcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactGroupCondition

contactcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactCondition

hourcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.HourCondition

model = None
identifier = 'context_condition'
name = 'Context Condition'
description = 'Context Condition'
active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(context)[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

campaign

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contactcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

contactgroupcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

hourcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.context_conditions.ContactGroupCondition(id, polymorphic_ctype, active, contextcondition_ptr)[source]

Bases: shuup.campaigns.models.context_conditions.ContextCondition

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
model

alias of ContactGroup

identifier = 'contact_group_condition'
name = 'Contact Group'
contact_groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

matches(context)[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.context_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.context_conditions.MultipleObjectsReturned

contextcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

contextcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.context_conditions.ContactCondition(id, polymorphic_ctype, active, contextcondition_ptr)[source]

Bases: shuup.campaigns.models.context_conditions.ContextCondition

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
model

alias of Contact

identifier = 'contact_condition'
name = 'Contact'
contacts

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

matches(context)[source]
description
values
exception DoesNotExist

Bases: shuup.campaigns.models.context_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.context_conditions.MultipleObjectsReturned

contextcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

contextcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.context_conditions.HourCondition(id, polymorphic_ctype, active, contextcondition_ptr, hour_start, hour_end, days)[source]

Bases: shuup.campaigns.models.context_conditions.ContextCondition

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • contextcondition_ptr (OneToOneField to shuup.campaigns.models.context_conditions.ContextCondition) – Contextcondition ptr
  • hour_start (TimeField) – 12pm is considered noon and 12am as midnight.
  • hour_end (TimeField) – 12pm is considered noon and 12am as midnight. End time is not considered match.
  • days (CharField) – Days

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
  • contextcondition_ptr (OneToOneField to shuup.campaigns.models.context_conditions.ContextCondition) – Contextcondition ptr
  • hour_start (TimeField) – 12pm is considered noon and 12am as midnight.
  • hour_end (TimeField) – 12pm is considered noon and 12am as midnight. End time is not considered match.
  • days (CharField) – Days
identifier = 'hour_condition'
name = 'Day and hour'
hour_start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hour_end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

days

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(context)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.context_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.context_conditions.MultipleObjectsReturned

contextcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

contextcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
values

shuup.campaigns.models.matching module

shuup.campaigns.models.matching.get_matching_context_conditions(context)[source]
shuup.campaigns.models.matching.update_matching_category_filters(shop_product, ids)[source]
shuup.campaigns.models.matching.update_matching_catalog_filters(shop_product_or_filter)[source]
shuup.campaigns.models.matching.get_matching_catalog_filters(shop_product)[source]

shuup.campaigns.models.product_effects module

class shuup.campaigns.models.product_effects.ProductDiscountEffect(id, polymorphic_ctype, campaign)[source]

Bases: shuup.core.models.PolymorphicShuupModel

Parameters:
productdiscountamount_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountAmount

productdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountPercentage

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
productdiscountamount_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountAmount

productdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountPercentage

identifier = None
model = None
admin_form_class = None
campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

apply_for_product(context, product, price_info)[source]

Applies the effect for product

Returns:amount of discount to accumulate for the product
Return type:Price
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

campaign_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productdiscountamount

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

productdiscountpercentage

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class shuup.campaigns.models.product_effects.ProductDiscountAmount(id, polymorphic_ctype, campaign, productdiscounteffect_ptr, discount_amount)[source]

Bases: shuup.campaigns.models.product_effects.ProductDiscountEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'discount_amount_effect'
name = 'Discount amount value'
discount_amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
value
apply_for_product(context, product, price_info)[source]
exception DoesNotExist

Bases: shuup.campaigns.models.product_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.product_effects.MultipleObjectsReturned

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productdiscounteffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

productdiscounteffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.campaigns.models.product_effects.ProductDiscountPercentage(id, polymorphic_ctype, campaign, productdiscounteffect_ptr, discount_percentage)[source]

Bases: shuup.campaigns.models.product_effects.ProductDiscountEffect

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
identifier = 'discount_percentage_effect'
name = 'Discount amount percentage'
admin_form_class

alias of PercentageField

discount_percentage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
exception DoesNotExist

Bases: shuup.campaigns.models.product_effects.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.product_effects.MultipleObjectsReturned

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productdiscounteffect_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

productdiscounteffect_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

value
apply_for_product(context, product, price_info)[source]

Module contents

class shuup.campaigns.models.BasketLineEffect(id, polymorphic_ctype, campaign)[source]

Bases: shuup.core.models.PolymorphicShuupModel

Parameters:
freeproductline_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.FreeProductLine

discountfromproduct_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromProduct

discountfromcategoryproducts_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromCategoryProducts

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
freeproductline_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.FreeProductLine

discountfromproduct_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromProduct

discountfromcategoryproducts_set

OneToOneRel to shuup.campaigns.models.basket_line_effects.DiscountFromCategoryProducts

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

admin_form_class = None
campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

campaign_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discountfromcategoryproducts

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

discountfromproduct

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

freeproductline

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

get_discount_lines(order_source, original_lines, supplier)[source]

Applies the effect based on given order_source

Returns:amount of discount to accumulate for the product
Return type:Iterable[shuup.core.order_creator.SourceLine]
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier = None
model = None
polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.BasketCampaign(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on, basket_line_text, coupon, supplier)[source]

Bases: shuup.campaigns.models.campaigns.Campaign

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the campaign is active.
  • name (CharField) – The name for this campaign.
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • active (BooleanField) – Enable this if the campaign is currently active. Please also set a start and an end date.
  • start_datetime (DateTimeField) – The date and time the campaign starts. This is only applicable if the campaign is marked as active.
  • end_datetime (DateTimeField) – The date and time the campaign ends. This is only applicable if the campaign is marked as active.
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
  • basket_line_text (CharField) – This text will be shown in a basket.
  • coupon (OneToOneField to shuup.campaigns.models.campaigns.Coupon) – Coupon
  • supplier (ForeignKey to shuup.core.models.Supplier) – When set, this campaign will match only products from the selected supplier. Rules and Effects will also be restricted to include only the products of this supplier.
  • conditions (ManyToManyField to shuup.campaigns.models.basket_conditions.BasketCondition) – Conditions
  • public_name (CharField) – (Translatable) The campaign name to show in the store front.
discount_effects

ManyToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountEffect

line_effects

ManyToOneRel to shuup.campaigns.models.basket_line_effects.BasketLineEffect

translations

ManyToOneRel to shuup.campaigns.models.campaigns.BasketCampaignTranslation

log_entries

ManyToOneRel to shuup.campaigns.models.campaigns.BasketCampaignLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
admin_url_suffix = 'basket_campaign'
basket_line_text

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

conditions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

coupon

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

coupon_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

discount_effects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

classmethod get_for_product(shop_product)[source]
classmethod get_matching(basket, lines)[source]
get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

line_effects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

log_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

public_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

rules_match(basket, lines)[source]

Check if basket rules match.

They will not match if: 1) The campaign is not active 2) The campaign has attached coupon,

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/campaigns/models/__init__.py:docstring of shuup.campaigns.models.BasketCampaign.rules_match, line 6)

Unexpected indentation.
which doesn’t match or is not active

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/campaigns/models/__init__.py:docstring of shuup.campaigns.models.BasketCampaign.rules_match, line 7)

Block quote ends without a blank line; unexpected unindent.
  1. Any of the attached rules don’t match
save(*args, **kwargs)[source]
shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

supplier

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

supplier_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

translations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class shuup.campaigns.models.BasketDiscountEffect(id, polymorphic_ctype, campaign)[source]

Bases: shuup.core.models.PolymorphicShuupModel

Parameters:
basketdiscountamount_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountAmount

basketdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountPercentage

discountpercentagefromundiscounted_set

OneToOneRel to shuup.campaigns.models.basket_effects.DiscountPercentageFromUndiscounted

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
basketdiscountamount_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountAmount

basketdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.basket_effects.BasketDiscountPercentage

discountpercentagefromundiscounted_set

OneToOneRel to shuup.campaigns.models.basket_effects.DiscountPercentageFromUndiscounted

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

admin_form_class = None
apply_for_basket(order_source)[source]

Applies the effect based on given order_source

Returns:amount of discount to accumulate for the product
Return type:Price
basketdiscountamount

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

basketdiscountpercentage

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

campaign_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

discountpercentagefromundiscounted

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier = None
model = None
polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.BasketCondition(id, polymorphic_ctype, active)[source]

Bases: polymorphic.models.PolymorphicModel

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
baskettotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalProductAmountCondition

baskettotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalAmountCondition

baskettotalundiscountedproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalUndiscountedProductAmountCondition

basketmaxtotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalProductAmountCondition

basketmaxtotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalAmountCondition

productsinbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ProductsInBasketCondition

contactgroupbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactGroupBasketCondition

contactbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactBasketCondition

categoryproductsbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.CategoryProductsBasketCondition

hourbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.HourBasketCondition

childrenproductcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ChildrenProductCondition

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
baskettotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalProductAmountCondition

baskettotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalAmountCondition

baskettotalundiscountedproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketTotalUndiscountedProductAmountCondition

basketmaxtotalproductamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalProductAmountCondition

basketmaxtotalamountcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.BasketMaxTotalAmountCondition

productsinbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ProductsInBasketCondition

contactgroupbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactGroupBasketCondition

contactbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ContactBasketCondition

categoryproductsbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.CategoryProductsBasketCondition

hourbasketcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.HourBasketCondition

childrenproductcondition_set

OneToOneRel to shuup.campaigns.models.basket_conditions.ChildrenProductCondition

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

basketmaxtotalamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

basketmaxtotalproductamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

baskettotalamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

baskettotalproductamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

baskettotalundiscountedproductamountcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

campaign

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

categoryproductsbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

childrenproductcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

contactbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

contactgroupbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

hourbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

matches(basket, lines)[source]
model = None
name = 'Basket condition'
polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productsinbasketcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class shuup.campaigns.models.Campaign(*args, **kwargs)[source]

Bases: shuup.utils.properties.MoneyPropped, parler.models.TranslatableModel

Parameters:
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the campaign is active.
  • name (CharField) – The name for this campaign.
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • active (BooleanField) – Enable this if the campaign is currently active. Please also set a start and an end date.
  • start_datetime (DateTimeField) – The date and time the campaign starts. This is only applicable if the campaign is marked as active.
  • end_datetime (DateTimeField) – The date and time the campaign ends. This is only applicable if the campaign is marked as active.
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
class Meta[source]

Bases: object

abstract = False
verbose_name = 'Campaign'
verbose_name_plural = 'Campaigns'
active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

admin_url_suffix = None
created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end_datetime

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
identifier

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_available()[source]
modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

modified_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects
save(*args, **kwargs)[source]
shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

shop_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start_datetime

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

type
class shuup.campaigns.models.ProductDiscountEffect(id, polymorphic_ctype, campaign)[source]

Bases: shuup.core.models.PolymorphicShuupModel

Parameters:
productdiscountamount_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountAmount

productdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountPercentage

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
productdiscountamount_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountAmount

productdiscountpercentage_set

OneToOneRel to shuup.campaigns.models.product_effects.ProductDiscountPercentage

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

admin_form_class = None
apply_for_product(context, product, price_info)[source]

Applies the effect for product

Returns:amount of discount to accumulate for the product
Return type:Price
campaign

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

campaign_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier = None
model = None
polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productdiscountamount

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

productdiscountpercentage

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class shuup.campaigns.models.CatalogCampaign(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on)[source]

Bases: shuup.campaigns.models.campaigns.Campaign

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the campaign is active.
  • name (CharField) – The name for this campaign.
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • active (BooleanField) – Enable this if the campaign is currently active. Please also set a start and an end date.
  • start_datetime (DateTimeField) – The date and time the campaign starts. This is only applicable if the campaign is marked as active.
  • end_datetime (DateTimeField) – The date and time the campaign ends. This is only applicable if the campaign is marked as active.
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
  • conditions (ManyToManyField to shuup.campaigns.models.context_conditions.ContextCondition) – Conditions
  • filters (ManyToManyField to shuup.campaigns.models.catalog_filters.CatalogFilter) – Filters
  • public_name (CharField) – (Translatable) The campaign name to show in the store front.
translations

ManyToOneRel to shuup.campaigns.models.campaigns.CatalogCampaignTranslation

log_entries

ManyToOneRel to shuup.campaigns.models.campaigns.CatalogCampaignLogEntry

effects

ManyToOneRel to shuup.campaigns.models.product_effects.ProductDiscountEffect

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
admin_url_suffix = 'catalog_campaign'
conditions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

effects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

filters

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

classmethod get_for_product(shop_product)[source]
classmethod get_matching(context, shop_product)[source]
get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

log_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

public_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

rules_match(context, shop_product, matching_catalog_filters, matching_context_conditions)[source]
save(*args, **kwargs)[source]
shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

translations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class shuup.campaigns.models.CatalogFilter(id, polymorphic_ctype, active)[source]

Bases: polymorphic.models.PolymorphicModel

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

producttypefilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductTypeFilter

productfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductFilter

categoryfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.CategoryFilter

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

producttypefilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductTypeFilter

productfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.ProductFilter

categoryfilter_set

OneToOneRel to shuup.campaigns.models.catalog_filters.CategoryFilter

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cached_shop_products

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

campaign

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

categoryfilter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

filter_queryset(queryset)[source]
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier = 'base_catalog_filter'
model = None
name = 'Base Catalog Filter'
polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
productfilter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

producttypefilter

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class shuup.campaigns.models.CatalogFilterCachedShopProduct(id, filter, shop_product)[source]

Bases: django.db.models.base.Model

Parameters:
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

filter

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

filter_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
shop_product

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

shop_product_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.campaigns.models.CategoryFilter(id, polymorphic_ctype, active, catalogfilter_ptr)[source]

Bases: shuup.campaigns.models.catalog_filters.CatalogFilter

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

exception DoesNotExist

Bases: shuup.campaigns.models.catalog_filters.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.catalog_filters.MultipleObjectsReturned

catalogfilter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

catalogfilter_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

categories

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

description
filter_queryset(queryset)[source]
get_matching_shop_products()[source]
identifier = 'category_filter'
matches(shop_product)[source]
model

alias of Category

name = 'Product Category'
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
values
class shuup.campaigns.models.ProductFilter(id, polymorphic_ctype, active, catalogfilter_ptr)[source]

Bases: shuup.campaigns.models.catalog_filters.CatalogFilter

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

exception DoesNotExist

Bases: shuup.campaigns.models.catalog_filters.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.catalog_filters.MultipleObjectsReturned

catalogfilter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

catalogfilter_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
filter_queryset(queryset)[source]
get_matching_shop_products()[source]
identifier = 'product_filter'
matches(shop_product)[source]
model

alias of Product

name = 'Product'
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
products

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

values
class shuup.campaigns.models.ProductTypeFilter(id, polymorphic_ctype, active, catalogfilter_ptr)[source]

Bases: shuup.campaigns.models.catalog_filters.CatalogFilter

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
cached_shop_products

ManyToOneRel to shuup.campaigns.models.cache.CatalogFilterCachedShopProduct

exception DoesNotExist

Bases: shuup.campaigns.models.catalog_filters.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.catalog_filters.MultipleObjectsReturned

catalogfilter_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

catalogfilter_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
filter_queryset(queryset)[source]
get_matching_shop_products()[source]
identifier = 'product_type_filter'
matches(shop_product)[source]
model

alias of ProductType

name = 'Product type'
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
product_types

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

values
class shuup.campaigns.models.ContextCondition(id, polymorphic_ctype, active)[source]

Bases: polymorphic.models.PolymorphicModel

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
contactgroupcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactGroupCondition

contactcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactCondition

hourcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.HourCondition

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
  • id (AutoField) – Id
  • polymorphic_ctype (ForeignKey to django.contrib.contenttypes.models.ContentType) – Polymorphic ctype
  • active (BooleanField) – Active
contactgroupcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactGroupCondition

contactcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.ContactCondition

hourcondition_set

OneToOneRel to shuup.campaigns.models.context_conditions.HourCondition

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

campaign

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contactcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

contactgroupcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

description = 'Context Condition'
hourcondition

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

identifier = 'context_condition'
matches(context)[source]
model = None
name = 'Context Condition'
polymorphic_ctype

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
class shuup.campaigns.models.ContactGroupSalesRange(id, group, shop, min_value, max_value)[source]

Bases: django.db.models.base.Model

Parameters:
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

clean()[source]
group

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

group_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_active()[source]
max_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

min_value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.ManagerFromSalesRangeQuerySet object>
save(*args, **kwargs)[source]
shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

shop_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.campaigns.models.ContactCondition(id, polymorphic_ctype, active, contextcondition_ptr)[source]

Bases: shuup.campaigns.models.context_conditions.ContextCondition

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
exception DoesNotExist

Bases: shuup.campaigns.models.context_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.context_conditions.MultipleObjectsReturned

contacts

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contextcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

contextcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
identifier = 'contact_condition'
matches(context)[source]
model

alias of Contact

name = 'Contact'
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
values
class shuup.campaigns.models.ContactGroupCondition(id, polymorphic_ctype, active, contextcondition_ptr)[source]

Bases: shuup.campaigns.models.context_conditions.ContextCondition

Parameters:

Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).

If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc

These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.

The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.

Parameters:
exception DoesNotExist

Bases: shuup.campaigns.models.context_conditions.DoesNotExist

exception MultipleObjectsReturned

Bases: shuup.campaigns.models.context_conditions.MultipleObjectsReturned

contact_groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

contextcondition_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

contextcondition_ptr_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description
identifier = 'contact_group_condition'
matches(context)[source]
model

alias of ContactGroup

name = 'Contact Group'
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
values
class shuup.campaigns.models.Coupon(id, code, usage_limit_customer, usage_limit, active, shop, supplier, created_by, modified_by, created_on, modified_on)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • code (CharField) – Code
  • usage_limit_customer (PositiveIntegerField) – Limit the amount of usages per a single customer.
  • usage_limit (PositiveIntegerField) – Set the absolute limit of usages for this coupon. If the limit is zero (0), coupon can’t be used.
  • active (BooleanField) – Is active
  • shop (ForeignKey to shuup.core.models.Shop) – The shop where the coupon is active.
  • supplier (ForeignKey to shuup.core.models.Supplier) – Supplier
  • created_by (ForeignKey to django.contrib.auth.models.User) – Created by
  • modified_by (ForeignKey to django.contrib.auth.models.User) – Modified by
  • created_on (DateTimeField) – Created on
  • modified_on (DateTimeField) – Modified on
campaign

OneToOneRel to shuup.campaigns.models.campaigns.BasketCampaign

usages

ManyToOneRel to shuup.campaigns.models.campaigns.CouponUsage

log_entries

ManyToOneRel to shuup.campaigns.models.campaigns.CouponLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
admin_url_suffix = 'coupon'
attach_to_campaign(campaign)[source]
attached
campaign

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

can_use_code(customer)[source]

Check if customer can use the code.

Parameters:customer (Contact or None) –
Return type:True|False
code

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exhausted
classmethod generate_code(length=6)[source]
get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_next_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_previous_by_modified_on(*, field=<django.db.models.fields.DateTimeField: modified_on>, is_next=False, **kwargs)
has_been_used(usage_count=1)[source]

See if code was already used the number of maximum times given

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

increase_customer_usage_limit_by(amount)[source]
increase_usage_limit_by(amount)[source]
classmethod is_usable(code, customer)[source]
log_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

modified_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified_on

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name_field = 'code'
objects = <django.db.models.manager.Manager object>
save(**kwargs)[source]
search_fields = ['code']
shop

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

shop_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

supplier

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

supplier_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

usage_limit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

usage_limit_customer

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

usages

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

use(order)[source]