shuup.discounts package
Subpackages
- shuup.discounts.admin package
- Subpackages
- shuup.discounts.admin.modules package
- shuup.discounts.admin.views package
- Module contents
ArchivedDiscountListView
DiscountDeleteView
DiscountEditView
DiscountListView
DiscountListView.default_columns
DiscountListView.format_end_datetime
DiscountListView.get_discount_effect
DiscountListView.get_queryset
DiscountListView.mass_actions
DiscountListView.mass_actions_provider_key
DiscountListView.model
DiscountListView.toolbar_buttons_provider_key
DiscountListView.url_identifier
HappyHourEditView
HappyHourDeleteView
HappyHourListView
- Module contents
- Submodules
- shuup.discounts.admin.mass_actions module
- shuup.discounts.admin.widgets module
- Module contents
- Subpackages
- shuup.discounts.models package
- Module contents
HappyHour
Discount
Discount.DoesNotExist
Discount.MultipleObjectsReturned
Discount.active
Discount.category
Discount.category_id
Discount.clean
Discount.contact
Discount.contact_group
Discount.contact_group_id
Discount.contact_id
Discount.created_by
Discount.created_by_id
Discount.created_on
Discount.discount_amount_value
Discount.discount_percentage
Discount.discounted_price_value
Discount.end_datetime
Discount.exclude_selected_category
Discount.get_next_by_created_on
Discount.get_next_by_modified_on
Discount.get_previous_by_created_on
Discount.get_previous_by_modified_on
Discount.happy_hours
Discount.id
Discount.identifier
Discount.modified_by
Discount.modified_by_id
Discount.modified_on
Discount.name
Discount.objects
Discount.product
Discount.product_id
Discount.save
Discount.shop
Discount.shop_id
Discount.shop_products_link
Discount.start_datetime
Discount.supplier
Discount.supplier_id
TimeRange
ShopProductCatalogDiscountsLink
ShopProductCatalogDiscountsLink.DoesNotExist
ShopProductCatalogDiscountsLink.MultipleObjectsReturned
ShopProductCatalogDiscountsLink.discounts
ShopProductCatalogDiscountsLink.id
ShopProductCatalogDiscountsLink.objects
ShopProductCatalogDiscountsLink.shop_product
ShopProductCatalogDiscountsLink.shop_product_id
- Module contents
Submodules
shuup.discounts.apps module
- class shuup.discounts.apps.AppConfig(*args, **kwargs)[source]
Bases:
AppConfig
- name = 'shuup.discounts'
- default_auto_field = 'django.db.models.BigAutoField'
- provides = {'admin_module': ['shuup.discounts.admin.modules.DiscountModule', 'shuup.discounts.admin.modules.DiscountArchiveModule', 'shuup.discounts.admin.modules.HappyHourModule'], 'admin_object_selector': ['shuup.discounts.admin.object_selector.DiscountAdminObjectSelector'], 'discount_module': ['shuup.discounts.modules:ProductDiscountModule'], 'xtheme_plugin': ['shuup.discounts.plugins:DiscountedProductsPlugin']}
See /provides for details about the
provides
variable.
shuup.discounts.exceptions module
shuup.discounts.modules module
- class shuup.discounts.modules.ProductDiscountModule[source]
Bases:
DiscountModule
- identifier = 'product_discounts'
- name = 'Product Discounts'
- discount_price(context, product, price_info)[source]
Discount given price of given product. :param context: Pricing context to operate in :param product: Product in question or its id :param price_info: Price to discount :return: A new instance of a discounted price
- index_shop_product(shop_product: ShopProduct | int, **kwargs)[source]
Index the shop product discounts. This is a heavy procedure, use with precaution and through some background task.
shuup.discounts.plugins module
- class shuup.discounts.plugins.ProductSelectionConfigForm(**kwargs)[source]
Bases:
GenericPluginForm
A configuration form for the DiscountedProductsPlugin
- base_fields = {}
- declared_fields = {}
- property media
Return all media required to render the widgets on this form.
- class shuup.discounts.plugins.DiscountedProductsPlugin(config)[source]
Bases:
TemplatedPlugin
Instantiate a Plugin with the given
config
dictionary.- Parameters:
config (dict) – Dictionary of freeform configuration data
- identifier = 'discount_product'
- name = 'Discounted Products'
- template_name = 'shuup/discounts/product_discount_plugin.jinja'
- editor_form_class
alias of
ProductSelectionConfigForm
- fields = [('title', <shuup.xtheme.plugins.forms.TranslatableField object>), ('count', <django.forms.fields.IntegerField object>), ('orderable_only', <django.forms.fields.BooleanField object>)]
shuup.discounts.settings module
- shuup.discounts.settings.SHUUP_DISCOUNTS_PER_PRODUCT_EXPIRATION_DATES = False
Whether the price expiration should be calculated per product instead of per shop
shuup.discounts.signal_handers module
shuup.discounts.utils module
- shuup.discounts.utils.get_potential_discounts_for_product(context, product, available_only=True, groups_ids=None, all_contacts=False)[source]
Get a queryset of all possible discounts for a given context and product
- If
available_only
is True, only the discounts which match happy hours, start/end dates will be returned
- If
available_only
is False, all discounts that match with the context and product, that are active will be returned.
- If
- shuup.discounts.utils.get_next_dates_for_range(weekday, from_hour, to_hour)[source]
Get datetime ranges for the next weekday
Example
Give me the date ranges for the next Sunday from 1pm to 10pm It will return a tuple of datetimes.
- If the requested weekday is the same of today, it will return both the ranges for today
and also for the next week.
:rtype list[datetime.datetime]
- shuup.discounts.utils.bump_price_expiration(shop_ids: Iterable[int])[source]
Bump price expiration cache for shop ids
- shuup.discounts.utils.get_price_expiration(context, product)[source]
Returns the price expiration for the product through a UNIX timestamp
This routine loads all dates that can possibly affect the price of the product in the future.
- After fetching all the event dates, the expiration time will
be the minimum datetime that is greater than now:
- expire_on = min(
- event_date for event_dates in [
next_discount_start, next_discount_ends, next_happy_hour_start, next_happy_hour_end,
] if event_date > now
)
:rtype numbers.Number|None :returns the price expiration time timestamp
Index all shop products that are affected by the given discounts