shoop.front package¶
Subpackages¶
- shoop.front.admin_module package
- shoop.front.apps package
- shoop.front.basket package
- shoop.front.checkout package
- shoop.front.models package
- shoop.front.template_helpers package
- shoop.front.templatetags package
- shoop.front.utils package
- shoop.front.views package
Submodules¶
shoop.front.error_handling module¶
-
shoop.front.error_handling.
install_error_handlers
()[source]¶ Install custom error handlers.
Error handlers to be added are for errors 400, 403, 404, and 500.
Error handlers will be injected only if: *
settings.SHOOP_FRONT_INSTALL_ERROR_HANDLERS
isTrue
*settings.ROOT_URLCONF
doesn’t already contain the handler
shoop.front.middleware module¶
-
shoop.front.middleware.
ProblemMiddleware
¶ alias of
ExceptionMiddleware
-
class
shoop.front.middleware.
ShoopFrontMiddleware
[source]¶ Bases:
object
Handle Shoop specific tasks for each request and response.
Set request attributes that rest of the Shoop 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
: Currently active Shop.
Todo
Define better
request.person
: PersonContact
of currently logged in user orAnonymousContact
if there is no logged in user.request.customer
: - Customer contact used when creating Orders. This can be same
as
request.person
, but for example in B2B shops this is usually aCompanyContact
whereasrequest.person
is aPersonContact
. request.basket
: - Shopping basket in use.
shoop.core.models.Shop
shoop.core.models.Contact
shoop.core.models.Contact
shoop.front.basket.objects.BaseBasket
shoop.front.notify_events module¶
-
class
shoop.front.notify_events.
OrderReceived
(**variable_values)[source]¶ Bases:
shoop.notify.base.Event
-
identifier
= 'order_received'¶
-
bindings
= {}¶
-
name
= 'Order Received'¶
-
variables
= {'order': <shoop.notify.base.Variable object at 0x7f52ff7e5be0>, 'customer_email': <shoop.notify.base.Variable object at 0x7f52ff7e5cc0>, 'language': <shoop.notify.base.Variable object at 0x7f52ff7e56a0>, 'customer_phone': <shoop.notify.base.Variable object at 0x7f52ff7e5828>}¶
-
shoop.front.settings module¶
-
shoop.front.settings.
SHOOP_BASKET_ORDER_CREATOR_SPEC
= 'shoop.front.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
shoop.front
code.
-
shoop.front.settings.
SHOOP_BASKET_VIEW_SPEC
= 'shoop.front.views.basket:DefaultBasketView'¶ Spec string for the Django CBV (or an API-compliant class) for the basket view.
This view deals with
/basket/
.
-
shoop.front.settings.
SHOOP_BASKET_COMMAND_DISPATCHER_SPEC
= 'shoop.front.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/
.
-
shoop.front.settings.
SHOOP_BASKET_UPDATE_METHODS_SPEC
= 'shoop.front.basket.update_methods:BasketUpdateMethods'¶ Spec string for the update method dispatcher used when the basket is updated (usually on the basket page).
-
shoop.front.settings.
SHOOP_BASKET_CLASS_SPEC
= 'shoop.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.
-
shoop.front.settings.
SHOOP_BASKET_STORAGE_CLASS_SPEC
= 'shoop.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.
-
shoop.front.settings.
SHOOP_CHECKOUT_VIEW_SPEC
= 'shoop.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
.
-
shoop.front.settings.
SHOOP_FRONT_INSTALL_ERROR_HANDLERS
= True¶ Whether Shoop uses its own error handlers.
If this value is set to
False
django defaults are used or the ones specified insettings.ROOT_URLCONF
file.Setting this to
True
won’t override handlers specified insettings.ROOT_URLCONF
.Handled error cases are: 400, 403, 404, and 500
-
shoop.front.settings.
SHOOP_FRONT_ADDRESS_FIELD_PROPERTIES
= {}¶ A dictionary defining properties to override the default field properties of the checkout address form. Should map the field name (as a string) to a dictionary containing the overridding Django form field properties, as in the following example which makes the postal code a required field:
- SHOOP_FRONT_ADDRESS_FIELD_PROPERTIES = {
- “postal_code”: {“required”: True}
}
It should be noted, however, that overriding some settings (such as making a required field non-required) could create other validation issues.
shoop.front.signals module¶
shoop.front.urls module¶
Module contents¶
-
class
shoop.front.
ShoopFrontAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.front'¶
-
verbose_name
= 'Shoop Frontend'¶
-
label
= 'shoop_front'¶
-
provides
= {'notify_event': ['shoop.front.notify_events:OrderReceived'], 'admin_module': ['shoop.front.admin_module.CartAdminModule']}¶
-