shuup.discounts.models package¶
Module contents¶
-
class
shuup.discounts.models.
AvailabilityException
(id, name, start_datetime, end_datetime)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (AutoField) – Id
- name (CharField) – The name for this exception. Used internally with exception lists for filtering.
- start_datetime (DateTimeField) – Set to restrict the availability exception to be available only after a certain date and time.
- end_datetime (DateTimeField) – Set to restrict the availability exception to be available only until a certain date and time.
- shops (ManyToManyField to
shuup.core.models.Shop
) – Shops
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
discounts
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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_end_datetime
(*, field=<django.db.models.fields.DateTimeField: end_datetime>, is_next=True, **kwargs)¶
-
get_next_by_start_datetime
(*, field=<django.db.models.fields.DateTimeField: start_datetime>, is_next=True, **kwargs)¶
-
get_previous_by_end_datetime
(*, field=<django.db.models.fields.DateTimeField: end_datetime>, is_next=False, **kwargs)¶
-
get_previous_by_start_datetime
(*, field=<django.db.models.fields.DateTimeField: start_datetime>, 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.
-
name
¶ 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>¶
-
shops
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
start_datetime
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
class
shuup.discounts.models.
CouponCode
(id, code, usage_limit_customer, usage_limit, active, 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 cannot be used.
- active (BooleanField) – 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
- shops (ManyToManyField to
shuup.core.models.Shop
) – Shops
-
usages
¶ ManyToOneRel to
shuup.discounts.models._coupon_codes.CouponUsage
-
coupon_code_discounts
¶ ManyToOneRel to
shuup.discounts.models._discounts.Discount
-
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.
-
attached
¶
-
code
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
coupon_code_discounts
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 aReverseManyToOneDescriptor
instance.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 aForwardManyToOneDescriptor
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
¶
-
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.
-
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 aForwardManyToOneDescriptor
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>¶
-
shops
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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 aReverseManyToOneDescriptor
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.discounts.models.
CouponUsage
(id, coupon, order, created_on)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (AutoField) – Id
- coupon (ForeignKey to
shuup.discounts.models._coupon_codes.CouponCode
) – Coupon - order (ForeignKey to
shuup.core.models.Order
) – Order - created_on (DateTimeField) – Created on
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
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 aForwardManyToOneDescriptor
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_on
¶ 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_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.
-
objects
= <django.db.models.manager.Manager object>¶
-
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 aForwardManyToOneDescriptor
instance.
-
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.discounts.models.
HappyHour
(id, name)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (AutoField) – Id
- name (CharField) – The name for this HappyHour. Used internally with exception lists for filtering.
- shops (ManyToManyField to
shuup.core.models.Shop
) – Shops
-
time_ranges
¶ ManyToOneRel to
shuup.discounts.models._happy_hours.TimeRange
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
discounts
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ 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
= <django.db.models.manager.Manager object>¶
-
shops
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
time_ranges
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 aReverseManyToOneDescriptor
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.discounts.models.
Discount
(id, name, identifier, created_by, modified_by, created_on, modified_on, supplier, active, start_datetime, end_datetime, product, exclude_selected_category, category, contact, exclude_selected_contact_group, contact_group, coupon_code, discounted_price_value, discount_amount_value, discount_percentage)[source]¶ Bases:
django.db.models.base.Model
,shuup.utils.properties.MoneyPropped
Parameters: - id (AutoField) – Id
- name (CharField) – The name for this discount. Used internally with discount lists for filtering.
- identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
- 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
- supplier (ForeignKey to
shuup.core.models.Supplier
) – Select supplier for this discount. - active (BooleanField) – Enable this if the discount is currently active. Please also set a start and an end date.
- start_datetime (DateTimeField) – The date and time the discount starts. This is only applicable if the discount is marked as active.
- end_datetime (DateTimeField) – The date and time the discount ends. This is only applicable if the discount is marked as active.
- product (ForeignKey to
shuup.core.models.Product
) – Select product for this discount. - exclude_selected_category (BooleanField) – Exclude products in selected category from this discount.
- category (ForeignKey to
shuup.core.models.Category
) – Select category for this discount. - contact (ForeignKey to
shuup.core.models.Contact
) – Select contact for this discount. - exclude_selected_contact_group (BooleanField) – Exclude contacts in selected contact group from this discount.
- contact_group (ForeignKey to
shuup.core.models.ContactGroup
) – Select contact group for this discount. - coupon_code (ForeignKey to
shuup.discounts.models._coupon_codes.CouponCode
) – Select coupon code for this discount. - discounted_price_value (MoneyValueField) – Discounted product price for this discount.
- discount_amount_value (MoneyValueField) – Discount amount value for this discount.
- discount_percentage (DecimalField) – Discount percentage for this discount.
- shops (ManyToManyField to
shuup.core.models.Shop
) – Shops - happy_hours (ManyToManyField to
shuup.discounts.models._happy_hours.HappyHour
) – Select happy hours for this discount. - availability_exceptions (ManyToManyField to
shuup.discounts.models._availability_exceptions.AvailabilityException
) – Select availability for this discount.
-
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.
-
availability_exceptions
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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 aForwardManyToOneDescriptor
instance.
-
category_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
contact
¶ 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 aForwardManyToOneDescriptor
instance.
-
contact_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 aForwardManyToOneDescriptor
instance.
-
contact_group_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
contact_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
coupon_code
¶ 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 aForwardManyToOneDescriptor
instance.
-
coupon_code_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 aForwardManyToOneDescriptor
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.
-
discount_amount_value
¶ 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.
-
discounted_price_value
¶ 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.
-
exclude_selected_category
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exclude_selected_contact_group
¶ 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)¶
-
happy_hours
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ 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.
-
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 aForwardManyToOneDescriptor
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
= <django.db.models.manager.ManagerFromDiscountQueryset object>¶
-
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 aForwardManyToOneDescriptor
instance.
-
product_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
shops
¶ 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
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
start_datetime
¶ 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 aForwardManyToOneDescriptor
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.discounts.models.
TimeRange
(id, happy_hour, parent, from_hour, to_hour, weekday)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (AutoField) – Id
- happy_hour (ForeignKey to
shuup.discounts.models._happy_hours.HappyHour
) – Happy hour - parent (ForeignKey to
shuup.discounts.models._happy_hours.TimeRange
) – Parent - from_hour (TimeField) – From hour
- to_hour (TimeField) – To hour
- weekday (IntegerField) – Weekday
-
children
¶ ManyToOneRel to
shuup.discounts.models._happy_hours.TimeRange
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
children
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 aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
from_hour
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
happy_hour
¶ 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 aForwardManyToOneDescriptor
instance.
-
happy_hour_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>¶
-
parent
¶ 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 aForwardManyToOneDescriptor
instance.
-
parent_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_hour
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
weekday
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.