class, order_model, discount_model, default_currency=None, **kwargs)[source]

Plata’s view and shop processing logic is contained inside this class.

Shop needs a few model classes with relations between them:

  • Contact model linking to Django’s auth.user
  • Order model with order items and an applied discount model
  • Discount model
  • Default currency for the shop (if you do not override default_currency in your own Shop subclass)


shop_instance = Shop(Contact, Order, Discount)

urlpatterns = [
    url(r'^shop/', include(shop_instance.urls)),
base_template = u'base.html'

The base template used in all default checkout templates

cart(request, order)[source]

Shopping cart view

checkout(request, order)[source]

Handles the first step of the checkout process

checkout_form(request, order)[source]

Returns the address form used in the first checkout step

confirmation(request, order)[source]

Handles the order confirmation and payment module selection checkout step

Hands off processing to the selected payment module if confirmation was successful.

confirmation_form(request, order)[source]

Returns the confirmation and payment module selection form


Return the contact object bound to the current user if the user is authenticated. Returns None if no contact exists.

create_order_for_user(user, request=None)[source]

Creates and returns a new order for the given user.


Return the default currency for instantiating new orders

Override this with your own implementation if you have a multi-currency shop with auto-detection of currencies.

discounts(request, order)[source]

Handles the discount code entry page

discounts_form(request, order)[source]

Returns the discount form

get_context(request, context, **kwargs)[source]

Helper method returning a context dict. Override this if you need additional context variables.


Import and return all payment modules defined in PLATA_PAYMENT_MODULES

If request is given only applicable modules are loaded.

order_from_request(request, create=False)[source]

Instantiate the order instance for the current session. Optionally creates a new order instance if create=True.

Returns None if unable to find an offer.


Forcibly create a new order and redirect user either to the frontpage or to the URL passed as next GET parameter


Handles order payment failures


Handles order successes for invoice payments where payment is still pending.


Handles order successes (e.g. when an order has been successfully paid for)


Return if the shop should show prices including tax

This returns the PLATA_PRICE_INCLUDES_TAX settings by default and is meant to be overridden by subclassing the Shop.

redirect(url_name, *args, **kwargs)[source]

Hook for customizing the redirect function when used as application content

render(request, template, context)[source]

Helper which just passes everything on to django.shortcuts.render

render_cart(request, context)[source]

Renders the shopping cart

render_cart_empty(request, context)[source]

Renders a cart-is-empty page

render_checkout(request, context)[source]

Renders the checkout page

render_confirmation(request, context)[source]

Renders the confirmation page

render_discounts(request, context)[source]

Renders the discount code entry page

reverse_url(url_name, *args, **kwargs)[source]

Hook for customizing the reverse function

set_order_on_request(request, order)[source]

Helper method encapsulating the process of setting the current order in the session. Pass None if you want to remove any defined order from the session.


Property offering access to the Shop-managed URL patterns


Overwrite this for custom authentication check. This is needed to support lazysignup, shop, request, **kwargs)[source]

Redirect to cart if later in checkout process and cart empty*checks)[source]

Calls all passed checkout process decorators in turn:


All checkout process decorators are called with the order, the shop instance and the request as keyword arguments. In the future, additional keywords might be added, your decorators should accept **kwargs as well for future compatibility., shop, request, **kwargs)[source]

Redirect to confirmation or already paid view if the order is already confirmed, shop, request, **kwargs)[source]

Redirect to cart if stock is insufficient and display an error message, shop, request, **kwargs)[source]

Show warnings in cart, but don’t redirect (meant as a replacement for order_cart_validates, but usable on the cart view itself), shop, request, **kwargs)[source]

ensure the user is authenticated and redirect to checkout if not