shuup.front package

Subpackages

Submodules

shuup.front.error_handlers module

class shuup.front.error_handlers.FrontPageErrorHandler[source]

Bases: shuup.core.error_handling.ErrorPageHandler

Page Error handler for Shuup Front

classmethod can_handle_error(request, error_status)[source]
classmethod handle_error(request, error_status)[source]

shuup.front.middleware module

shuup.front.middleware.ProblemMiddleware

alias of ExceptionMiddleware

class shuup.front.middleware.ShuupFrontMiddleware[source]

Bases: object

Handle Shuup specific tasks for each request and response.

  • Set request attributes that rest of the Shuup front-end rely on.

  • Set Django’s timezone according to personal preferences (i.e. request.person.timezone).

    Todo

    Fallback to shop timezone?

  • Make sure that basket is saved before response is returned to the browser.

Attributes set for requests:

request.shop
: shuup.core.models.Shop

Currently active Shop.

Todo

Define better

request.person
: shuup.core.models.Contact
PersonContact of currently logged in user or AnonymousContact if there is no logged in user.
request.customer
: shuup.core.models.Contact
Customer contact used when creating Orders. This can be same as request.person, but for example in B2B shops this is usually a CompanyContact whereas request.person is a PersonContact.
request.basket
: shuup.front.basket.objects.BaseBasket
Shopping basket in use.
process_request(request)[source]
process_response(request, response)[source]
classmethod refresh_on_user_change(request, user=None, **kwargs)[source]
classmethod refresh_on_logout(request, **kwargs)[source]
process_view(request, view_func, *view_args, **view_kwargs)[source]

shuup.front.notify_events module

class shuup.front.notify_events.OrderReceived(**variable_values)[source]

Bases: shuup.notify.base.Event

identifier = 'order_received'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
bindings = {}
variables = {'shop_email': <shuup.notify.base.Variable object at 0x7fabcf69dc18>, 'order': <shuup.notify.base.Variable object at 0x7fabcf7ca470>, 'customer_phone': <shuup.notify.base.Variable object at 0x7fabcf69db70>, 'shop_phone': <shuup.notify.base.Variable object at 0x7fabcf69dcc0>, 'customer_email': <shuup.notify.base.Variable object at 0x7fabcf7ca2e8>, 'language': <shuup.notify.base.Variable object at 0x7fabcf69dd68>}
class shuup.front.notify_events.ShipmentCreated(**variable_values)[source]

Bases: shuup.notify.base.Event

identifier = 'shipment_created'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
bindings = {}
variables = {'shipping_status': <shuup.notify.base.Variable object at 0x7fabcf695208>, 'shipment_status': <shuup.notify.base.Variable object at 0x7fabcf6952b0>, 'order': <shuup.notify.base.Variable object at 0x7fabcf69de80>, 'customer_phone': <shuup.notify.base.Variable object at 0x7fabcf69df98>, 'shipment': <shuup.notify.base.Variable object at 0x7fabcf695160>, 'customer_email': <shuup.notify.base.Variable object at 0x7fabcf69def0>, 'language': <shuup.notify.base.Variable object at 0x7fabcf695080>}
class shuup.front.notify_events.ShipmentDeleted(**variable_values)[source]

Bases: shuup.notify.base.Event

identifier = 'shipment_deleted'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
bindings = {}
variables = {'shipping_status': <shuup.notify.base.Variable object at 0x7fabcf6956d8>, 'order': <shuup.notify.base.Variable object at 0x7fabcf695390>, 'customer_phone': <shuup.notify.base.Variable object at 0x7fabcf6954a8>, 'shipment': <shuup.notify.base.Variable object at 0x7fabcf695630>, 'customer_email': <shuup.notify.base.Variable object at 0x7fabcf695400>, 'language': <shuup.notify.base.Variable object at 0x7fabcf695550>}
class shuup.front.notify_events.PaymentCreated(**variable_values)[source]

Bases: shuup.notify.base.Event

identifier = 'payment_created'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
bindings = {}
variables = {'order': <shuup.notify.base.Variable object at 0x7fabcf6957f0>, 'payment_status': <shuup.notify.base.Variable object at 0x7fabcf695ba8>, 'customer_phone': <shuup.notify.base.Variable object at 0x7fabcf695978>, 'language': <shuup.notify.base.Variable object at 0x7fabcf695a58>, 'customer_email': <shuup.notify.base.Variable object at 0x7fabcf695898>, 'payment': <shuup.notify.base.Variable object at 0x7fabcf695c50>}
class shuup.front.notify_events.RefundCreated(**variable_values)[source]

Bases: shuup.notify.base.Event

identifier = 'refund_created'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
bindings = {}
variables = {'language': <shuup.notify.base.Variable object at 0x7fabcf6a9080>, 'customer_email': <shuup.notify.base.Variable object at 0x7fabcf695e80>, 'order': <shuup.notify.base.Variable object at 0x7fabcf695dd8>, 'payment_status': <shuup.notify.base.Variable object at 0x7fabcf6a91d0>, 'customer_phone': <shuup.notify.base.Variable object at 0x7fabcf695f60>}
shuup.front.notify_events.send_order_received_notification(order, **kwargs)[source]
shuup.front.notify_events.send_shipment_created_notification(order, shipment, **kwargs)[source]
shuup.front.notify_events.send_shipment_deleted_notification(shipment, **kwargs)[source]
shuup.front.notify_events.send_payment_created_notification(order, payment, **kwargs)[source]
shuup.front.notify_events.send_refund_created_notification(order, refund_lines, **kwargs)[source]

shuup.front.settings module

shuup.front.settings.SHUUP_BASKET_ORDER_CREATOR_SPEC = 'shuup.core.basket.order_creator:BasketOrderCreator'

Spec string for the class used for creating Order from a Basket.

This is the easiest way to customize the order creation process without having to override a single URL or touch the shuup.front code.

shuup.front.settings.SHUUP_BASKET_VIEW_SPEC = 'shuup.front.views.basket:DefaultBasketView'

Spec string for the Django CBV (or an API-compliant class) for the basket view.

This view deals with /basket/.

shuup.front.settings.SHUUP_BASKET_COMMAND_DISPATCHER_SPEC = 'shuup.core.basket.command_dispatcher:BasketCommandDispatcher'

Spec string for the command dispatcher used when products are added/deleted/etc. from the basket.

This view deals with commands POST``ed to ``/basket/.

shuup.front.settings.SHUUP_BASKET_UPDATE_METHODS_SPEC = 'shuup.core.basket.update_methods:BasketUpdateMethods'

Spec string for the update method dispatcher used when the basket is updated (usually on the basket page).

shuup.front.settings.SHUUP_BASKET_CLASS_SPEC = 'shuup.front.basket.objects:BaseBasket'

Spec string for the basket class used in the frontend.

This is used to customize the behavior of the basket for a given installation, for instance to modify prices of products based on certain conditions, etc.

shuup.front.settings.SHUUP_BASKET_STORAGE_CLASS_SPEC = 'shuup.front.basket.storage:DatabaseBasketStorage'

The spec string defining which basket storage class to use for the frontend.

Basket storages are responsible for persisting visitor basket state, whether in the database (DatabaseBasketStorage) or directly in the session (DirectSessionBasketStorage). Custom storage backends could use caches, flat files, etc. if required.

shuup.front.settings.SHUUP_CHECKOUT_VIEW_SPEC = 'shuup.front.views.checkout:DefaultCheckoutView'

Spec string for the Django CBV (or an API-compliant class) for the checkout view.

This is used to customize the behavior of the checkout process; most likely to switch in a view with a different phase_specs.

shuup.front.settings.SHUUP_FRONT_DEFAULT_SORT_CONFIGURATION = {'sort_products_by_price_ordering': 2, 'sort_products_by_price': True, 'sort_products_by_name': True, 'sort_products_by_name_ordering': 1}

Default product lists facet configuration

This configuration will be used if the configuration is not set from admin

shuup.front.settings.SHUUP_TEMPLATE_HELPERS_CACHE_DURATION = 1800

Default cache duration for template helpers

Cache duration in seconds for front template helpers. Default 30 minutes.

shuup.front.settings.SHUUP_PERSON_CONTACT_FIELD_PROPERTIES = {}

A dictionary defining properties to override the default field properties of the person contact form. Should map the field name (as a string) to a dictionary containing the overriding Django form field properties, as in the following example which makes the gender field hidden:

SHUUP_PERSON_CONTACT_FIELD_PROPERTIES = {
“gender”: {“widget”: forms.HiddenInput()}

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/v2.0.0/shuup/front/settings.py:docstring of shuup.front.settings.SHUUP_PERSON_CONTACT_FIELD_PROPERTIES, line 8)

Definition list ends without a blank line; unexpected unindent.

}

It should be noted, however, that overriding some settings (such as making a required field non-required) could create other validation issues.

shuup.front.signals module

shuup.front.urls module

Module contents

class shuup.front.ShuupFrontAppConfig(*args, **kwargs)[source]

Bases: shuup.apps.AppConfig

name = 'shuup.front'
verbose_name = 'Shuup Frontend'
label = 'shuup_front'
provides = {'notify_event': ['shuup.front.notify_events:OrderReceived', 'shuup.front.notify_events:ShipmentCreated', 'shuup.front.notify_events:ShipmentDeleted', 'shuup.front.notify_events:PaymentCreated', 'shuup.front.notify_events:RefundCreated'], 'admin_module': ['shuup.front.admin_module.CartAdminModule'], 'notify_script_template': ['shuup.front.notify_script_templates:PaymentCreatedEmailScriptTemplate', 'shuup.front.notify_script_templates:RefundCreatedEmailScriptTemplate', 'shuup.front.notify_script_templates:ShipmentDeletedEmailScriptTemplate', 'shuup.front.notify_script_templates:OrderConfirmationEmailScriptTemplate', 'shuup.front.notify_script_templates:ShipmentCreatedEmailScriptTemplate'], 'admin_shop_form_part': ['shuup.front.admin_module.sorts_and_filters.form_parts.ConfigurationShopFormPart'], 'front_extend_product_list_form': ['shuup.front.forms.product_list_modifiers.CategoryProductListFilter', 'shuup.front.forms.product_list_modifiers.LimitProductListPageSize', 'shuup.front.forms.product_list_modifiers.ProductPriceFilter', 'shuup.front.forms.product_list_modifiers.ProductVariationFilter', 'shuup.front.forms.product_list_modifiers.SortProductListByCreatedDate', 'shuup.front.forms.product_list_modifiers.SortProductListByAscendingCreatedDate', 'shuup.front.forms.product_list_modifiers.SortProductListByName', 'shuup.front.forms.product_list_modifiers.SortProductListByPrice', 'shuup.front.forms.product_list_modifiers.ManufacturerProductListFilter'], 'admin_category_form_part': ['shuup.front.admin_module.sorts_and_filters.form_parts.ConfigurationCategoryFormPart'], 'front_product_order_form': ['shuup.front.forms.order_forms:VariableVariationProductOrderForm', 'shuup.front.forms.order_forms:SimpleVariationProductOrderForm', 'shuup.front.forms.order_forms:SimpleProductOrderForm']}
ready()[source]