Shoop documentation

Contents

Getting Started with Shoop

Note

If you are planning on developing Shoop, read the other Getting Started guide instead.

Installation

Todo

Update this when Shoop is published to PyPI.

This guide assumes familiarity with the PyPA tools for Python packaging, including pip and virtualenv.

  1. Set up a new virtualenv for your Shoop project.

  2. Grab a Git clone of the Shoop sources. For this guide, we’ll assume the checkout of the clone lives in /stuff/shoop.

  3. Activate the virtualenv. Within the virtualenv, run

    pip install /stuff/shoop
    

This will install Shoop and its dependencies into your virtualenv.

After this, you can begin setting up a Django project using whichever standards you fancy.

Shoop Packages

Shoop is a constellation of Django apps, with many delivered in the single “Shoop Base” distribution, and with additional apps available as separate downloads.

The core package all Shoop installations will require is shoop.core. It contains the core business logic for e-commerce, and all of the database models required. However, it contains no frontend or admin dashboard, as different projects may wish to replace them with other components or even elide them altogether.

A default frontend, a basic but fully featured storefront, is included, as the application shoop.front. It itself has several sub-applications that may be used to toggle functionality on and off.

Todo

Describe the sub-apps.

A fully featured administration dashboard is also included as the application shoop.admin.

Basic Administration Tasks

Todo

Revise this when user management lands in the admin.

You can use the built-in Django management commands createsuperuser and changepassword to manage superusers and change user passwords.

See also Creating superusers from Django’s documentation.

Developer documentation

Getting Started with Shoop Development

Note

If you are planning on using Shoop for developing your own shop, read the other Getting Started guide instead.

Installation for Shoop Development

To start developing Shoop, you’ll need a Git checkout of Shoop and a Github fork of Shoop for creating pull requests. Github pull requests are used to get your changes into Shoop Base.

  1. If you haven’t done so already, create a fork of Shoop in Github by clicking the “Fork” button at https://github.com/shoopio/shoop and clone the fork to your computer as usual. See Github Help about forking repos for details.

  2. Setup a virtualenv and activate it. You may use the traditional virtualenv command, or the newer python -m venv if you’re using Python 3. See Virtualenv User Guide, if you don’t know virtualenv already. For example, following commands create and activate a virtualenv in Linux:

    virtualenv shoop-venv
    . shoop-venv/bin/activate
    
  3. Finally, you’ll need to install Shoop in the activated virtualenv in development mode. To do that, run the following commands in the root of the checkout (within the activated virtualenv):

    pip install -e .
    python setup.py build_resources
    

Workbench, the built-in test project

The Workbench project in the repository is a self-contained Django project set up to use an SQLite database. It is used by the test suite and is also useful for development on its own.

Practically the only difference to a normal Django project is that instead of python manage.py, one uses python -m shoop_workbench.

To get started with Workbench, invoke the following in the Shoop working copy root.

# Migrate database.
python -m shoop_workbench migrate

# Import some basic data.
python -m shoop_workbench shoop_populate_mock --with-superuser=admin

# Run the Django development server (on port 8000 by default).
python -m shoop_workbench runserver

You can use the credentials admin/admin, that is username admin and password admin to log in as a superuser on http://127.0.0.1:8000/ .

Building resources

Shoop uses JavaScript and CSS resources that are compiled using various Node.js packages. These resources are compiled automatically by setup.py when installing Shoop with pip, but if you make changes to the source files (e.g. under shoop/admin/static_src), the resources have to be rebuilt.

This can be done with

python setup.py build_resources

The command also accepts couple arguments, see its help for more details:

python setup.py build_resources --help

Running tests

To run tests in the active virtualenv:

py.test -v shoop_tests
# Or with coverage
py.test -vvv --cov shoop --cov-report html shoop_tests

To run tests for all supported Python versions run:

pip install tox  # To install tox, needed just once
tox

Docstring coverage

The DocCov script is included for calculating some documentation coverage metrics.

python _misc/doccov.py shoop/core -o doccov.html

Glossary

Software Components

Shoop
Shoop is a framework for building web shops or ordering portals.
Shoop Core
Shoop Core is the kernel of the Shoop. It is part of every Shoop installation.
Shoop Base
Shoop Base contains Shoop Core and optional modules.
Module

Todo

Define module

Todo

Define all plugin terms

Entities

user
user is general definition of any user
admin
admin is one kind of user
customer
Customer is one kind of user or one kind of company. Customer can be an admin and vice versa.
company
Company is one kind of organization. Organization is general definition of any group of companies and/or users.
shop

Todo

Define shop

Data model

Data in Shoop is stored into database using regular Django models and it is accessed with Django’s normal query API. See shoop.core.models for list of models in Shoop Core.

Extending models

Non-polymorphic models

Basic models (like Product, Category or Order) cannot be replaced. To extend them, create a new model for your extensions and link that to the original model with a OneToOneField.

For example:

from django.core import models
from shoop.core import models as shoop_models

class MyProduct(models.Model):
    product = models.OneToOneField(shoop_models.Product)

    # fields of the extension...
    my_field = models.CharField(max_length=10)
    ...

Todo

Check Multi-table inheritance for extending models

Note

Even though basic models cannot be replaced, it is possible to replace the User model. See Specifying a custom User model.

Polymorphic models

Polymorphic models (like Contact) can be extended by inheritance. The polymorphic base class has a model manager that makes sure that the returned objects are correct type. For example, when getting all Contacts with a query like Contact.objects.all(), the returned QuerySet may have instances of PersonContact, CompanyContact and your custom class.

See django-polymorphic’s documentation for details.

The Provides system

The Provides system is Shoop’s mechanism for discovering and loading components, both first-party and third-party. Shoop apps use the provides system in various ways.

  • The core itself uses Provides for discovering method and supplier modules.
  • shoop.admin uses Provides to load admin modules, form customizations etc.
  • shoop.front uses it for URLconf overrides etc.

Todo

Document the various ways better.

Provides are grouped under different categories, such as admin_module, shipping_method_module, front_urls, etc.

Declaring Provides

Shoop uses the Django 1.7+ AppConfig system to declare provides.

Quite simply, a developer needs only include a dict with provide categories as the keys and lists of loading specs as values for new provides to be discovered.

class PigeonAppConfig(AppConfig):

    provides = {
        "shipping_method_module": [
            "pigeon.module:PigeonShippingModule"
        ]
    }

Note

Some provides also require the class named by the spec string to include an identifier field. Refer to the implementation guides for particular functionalities for details.

Using Provides

Provide management functions are found in the shoop.apps.provides module.

In general, the shoop.apps.provides.get_provide_objects method is your most useful entry point.

Provide Categories

admin_category_form_part
Additional FormPart classes for Category editing.
admin_contact_form_part
Additional FormPart classes for Contact editing.
admin_product_form_part
Additional FormPart classes for Product editing. (This is used by pricing modules, for instance.)
admin_module
Admin module classes. Practically all of the functionality in the admin is built via admin modules.
front_template_helper_namespace

Additional namespaces to install in the shoop “package” within template contexts. .. seealso:: :doc:`Custom Template Helper Functions`_

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/provides.rst, line 61); backlink

Mismatch: both interpreted text role prefix and reference suffix.
front_urls
Lists of frontend URLs to be appended to the usual frontend URLs.
front_urls_post
Lists of frontend URLs to be appended to the usual frontend URLs, even after front_urls. Most of the time, front_urls should do.
front_urls_pre
Lists of frontend URLs to be prepended to the usual frontend URLs. Most of the time, front_urls should do.
notify_action
Notification framework Action classes.
notify_condition
Notification framework Condition classes.
notify_event
Notification framework Event classes.
payment_method_module
Payment method module classes (deriving from shoop.core.methods.base.BasePaymentMethodModule), as used by shoop.core.models.PaymentMethod.
pricing_module
Pricing module classes; the pricing module in use is set with the SHOOP_PRICING_MODULE setting.
shipping_method_module
Shipping method module classes (deriving from shoop.core.methods.base.BaseShippingMethodModule), as used by shoop.core.models.ShippingMethod.
supplier_module
Supplier module classes (deriving from shoop.core.suppliers.base.BaseSupplierModule), as used by shoop.core.models.Supplier.
tax_module
Tax module classes; the tax module in use is set with the SHOOP_TAX_MODULE setting.

Addons

Shoop contains facilities for installing, detecting, loading and configuring additional functionality with little or no system administration knowledge needed. Packages that can be loaded in this way are called Addons. Addons aren’t very special, though: under the surface they are nothing more than standard Django applications that are discovered using the Setuptools Entry Points mechanism. Functionality registration after this occurs via the Shoop Provides subsystem.

Configuring your project to load addons

The Shoop addon manager handles adding addons into Django’s INSTALLED_APPS list during project initialization time.

It’s easy to convert a standard Django configuration to be addons enabled.

For instance, take a bare-bones Shoop core installation.

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'shoop.core',
    'shoop.simple_pricing',
    'shoop.simple_supplier',
    'shoop.default_tax',
    'shoop.admin',
)

The management interface for the addon loader requires one additional configuration key, SHOOP_ENABLED_ADDONS_FILE, to name a path to a configuration file that is writable by the application server.

The shoop.addons.add_enabled_addons() method manages reading this file, cross-referencing them with the entry points published by Setuptools and adding them into the installed apps list.

Putting this all together,

from shoop.addons import add_enabled_addons

# *snip*

# This varies depending on how your particular project arranges writable files.
SHOOP_ENABLED_ADDONS_FILE = os.path.join(BASE_DIR, "enabled_addons")

INSTALLED_APPS = add_enabled_addons(SHOOP_ENABLED_ADDONS_FILE, (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'shoop.core',
    'shoop.simple_pricing',
    'shoop.simple_supplier',
    'shoop.default_tax',
    'shoop.admin',
    'shoop.addons',
))

# *snip*

will enable your project to load Shoop addons.

Installing and configuring addons

Once shoop.addons is in your INSTALLED_APPS list, a section for managing addons appears in the administration panel.

Developing addons

As discussed before, addons are simply Django applications with a Setuptools entry_points stanza in setup.py.

This means addon development doesn’t require any special steps; just adding the new application to a test project’s (such as Workbench’s) INSTALLED_APPS is enough to get you running.

Preparing addons for distribution

When the time comes to actually distribute your new addon, configure your package according to the PyPUG guidelines and within the entry_points section add a shoop.addon entry point stanza, such as this (example taken from the shoop-pugme addon):

setuptools.setup(
    # ...
    entry_points={"shoop.addon": "shoop_pugme=shoop_pugme"}
)

Note

It’s recommended you follow the name=name format for the entry point definition. Further iterations of addon discovery may change the format.

With this in your setup.py, you can now

  • Use python setup.py sdist to create a source distribution for your addon and install it via the administration panel as you would for any old addon.
  • Or run pip install -e . to install the addon in your shop’s virtualenv in editable mode, then enable the addon via the administration panel.

(If you had manually added the application into your INSTALLED_APPS as discussed before, this would be a good time to take it out of there, as otherwise Django will complain about duplicates.)

Template Design

This part of the documentation covers the structural elements of Shoop’s default templates and instructs you on how to create your own customized templates.

To be able to create customized templates you’ll need to have understanding of the principles of HTML and CSS.

If you would like to start creating your own customized templates with these instructions you should already have a working Shoop installation with the default template up and running. If not, you can start by reading Getting Started guide.

Shoop’s default templates

Shoop’s default templates are written with Jinja2 which is a templating engine for Python very similar to Django’s templates.

The default templates use the Bootstrap 3 framework, which consists of Bootstrap’s HTML structure and Bootstrap specified CSS classes. If you want to create your own templates, it would require using Bootstrap 3 or overwriting all the template files with your custom HTML structure and HTML classes.

Shoop’s template files are easy to modify and basic knowledge of HTML and CSS takes you far. Shoop’s default templates already include the necessary template tags to print out all the features a basic shop would need. It is fairly simple to add your custom HTML elements around template tags and customize your shop to your needs.

Template folder structure

Shoop utilizes a similar folder structure for all the templates in different apps. All the template files are always included in the app folder shoop/APP/templates/.

Within this template folder the folder structure is: APP/MODULE/TEMPLATE.jinja. For example, this could be converted into shoop/product/detail.jinja

The default templates can be found in folder under shoop/front/templates/.

Example

The Simple CMS module has a template to show pages created with it. This page.jinja template can be found under the Simple CMS template folder: shoop/simple_cms/templates/ where the path to the template file is shoop/simple_cms/page.jinja.

Other default template features such as user authentication, customer info, order history, registration and search etc. can be found in their own application templates under shoop/front/apps/. Each app has it’s own template folder containing application specific templates.

Templates have been split into separate files and each file has its own purpose. Template files inherit the base layout from shoop/base.jinja.

General

General template files can be found under shoop/front/templates/

Base shoop/front/base.jinja
Defines the structure of your templates. It includes the <html>, <head> and <body> tags, and the general structure of all frontend pages (unless explicitly overridden).
Index shoop/front/index.jinja
Your shop’s home page.
Macros shoop/front/macros.jinja
Additional template macros that can be used in other template files. For example single product box is rendered with a macro, where it can be called with customized parameters. Also form fields, alerts and order details can be generated with macros.
Includes shoop/front/includes/
Additional HTML that can be included in pages. In default templates all the included filenames start with _. All navigation related HTML and template tags are included to base.jinja and for example you could create a _footer.jinja to be included if needed.
Products and Categories

Product and category templates can be found under shoop/front/templates/

Detail shoop/front/product/detail.jinja
The view for a single product. Displays a product and its details. The file uses template tags to include product attributes and ordering sections.
Category shoop/front/product/category.jinja
A view for a single category. This template lists all the products of the selected category.
Shopping basket

All shopping basket related templates go in the shoop/front/templates/shoop/front/basket folder. This includes the default structure of the shopping basket and additional shopping basket elements.

The default shopping basket template also includes the ordering form. This does not apply to shops using multi-phase checkout.

Default Basket shoop/front/basket/default_basket.jinja
The structure of shopping basket. It includes the shopping basket’s contents as a table from a separate file in the partials folder. The ordering form is also displayed in this file.
Orders

Order related templates can be found in shoop/front/templates/shoop/front/order/.

Complete shoop/front/order/complete.jinja
Displays the order success message and details of the order.
Payment Canceled shoop/front/order/payment_canceled.jinja
Template for displaying payment cancellation.
Authentication

Authentication through the Shoop Front is another sub-app. Its templates can be found in its own folder: shoop/front/apps/auth/templates/shoop/user/

Login and Logout
Templates for login form and logout message pages.
Password Recovery
Password recovery process including the templates for shop and e-mail.
Registration

Registration is another sub-app. Its templates can be found in: shoop/front/apps/registration/templates

Registration Form shoop/registration/register.jinja
Registration form template for new users.
Activation Failed shoop/registration/activation_failed.jinja
A template for displaying an error message when account activation fails.
Customer Information

Customer information is another sub-app. Its templates can be found in: shoop/front/apps/customer_information/templates/

Edit shoop/customer_information/edit.jinja
Template for editing customer details.
Personal Order History

Personal Order History, another sub-app, naturally has its templates in its own folder. shoop/front/apps/personal_order_history/templates/

Order Detail shoop/personal_order_history/order_detail.jinja
Template for displaying single order’s details.
Order List shoop/personal_order_history/order_list.jinja
Template for listing all the previous personal orders.

Custom Template Helper Functions

This paragraph explains how to register template functions in Shoop’s sub-apps. If you are interested in Jinja2‘s way to do it, please refer to the Jinja2 documentation.

The AppConfig

The front_template_helper_namespace category in the provides dictionary tells the framework that there are template helper functions to be found in the namespace class (TemplateHelper) given.

For more information about provides please refer to the documentation

The TemplateHelper class

This class contains all the functions that the are exposed for frontend templates.

Using helpers in a template

The template helpers can be used in templates with shoop.<module_name>.<TemplateHelper::method>(). For example shoop.my_module.get_day_names().

Static files

Static files such as images, stylesheets and scripts go under the static folder, using the Django staticfiles framework <https://docs.djangoproject.com/en/1.8/howto/static-files/>.

You can access static data files in templates by using the {{ static() }} function. For example, if you have img/image.jpg in your static files, generating a src for an <img> tag would be as easy as <img src="{{ static(img/image.jpg") }}">.

Creating custom templates

The basic principle of creating custom Shoop templates is not to modify the original files (default templates) within the app directory, but to copy them into to your own application’s template directory. If your own application is set before Shoop in Django’s INSTALLED_APPS configuration, Django will prefer your templates over Shoop’s default ones.

This means it is possible to overwrite only some of the default template files or all of them. If there is no customized template with the same path and filename, Django will use the default template file instead.

All the template files that you want to customize go under your application’s template folder in the same folder hierarchy as under the original app’s templates folder. The folder hierarchy for Shoop’s default templates was discussed earlier in this document.

Example

Let’s say you only would like to make a customized home page for your shop, but leave all other templates as they are. Let’s call your application myshop.

Simply copy index.jinja from shoop/front/templates/shoop/index.jinja to your application’s template folder myshop/templates/shoop/index.jinja, then modify it to your heart’s content.

Now let’s say you want to tweak the product category view too.

Copy shoop/front/templates/shoop/product/category.jinja to myshop/templates/shoop/product/category.jinja, then start modifying. As you can see, the template directory structure within your myshop application reflects the one in the original app.

Taxes in Shoop

Settings

shoop.core setting:

SHOOP_TAX_MODULE = "default_tax"

Classes

LineTax interface
  • tax
  • name
  • amount
  • base_amount (Amount that this tax is calculated from)
  • rate (property calculated from amount / base_amount)
OrderLineTax (creatable from LineTax)
  • FK: order_line
  • FK: tax (NULL) # for reporting
  • name
  • amount
  • base_amount
  • ordering
  • rate (cached)
OrderLine
def cache_prices(self):
    self.tax_amount = sum(t.amount for t in self.taxes)
    self.taxful_price = self.taxless_price + self.tax_amount
    self.tax_rate = self.tax_amount / self.taxless_amount
Tax
  • identifier (NULL)
  • name (i18n)
  • rate (%)
  • value (home currency)
TaxClass
  • identifier
  • name (i18n)
CustomerTaxGroup
  • identifier
  • name (i18n)
Product / Method
  • ...
  • tax_class (FK)
  • ...
default_tax.TaxRule
  • tax_classes (M2M)
  • customer_tax_groups (M2M)
  • enabled
  • countries
  • regions (regexp? :D)
  • postal_codes (regexp? :D)
  • tax (FK)
  • priority (Rules with same priority are value-added (e.g. US taxes) and rules with different priority are compound taxes (e.g. Canada Quobec PST usecase))
TaxModule
  • get_product_tax_amount(tax_view, product) -> home currency (Called upon product price saving to recache things in ShopProduct)
  • get_method_tax_amount(tax_view, method) -> home currency
  • get_line_taxes(order_source, line) -> Iterable[LineTax]
  • ...
TaxView
  • customer_tax_group (FK)
  • location (country, region, postal_code, ...)
  • show_taxful_prices : bool

Shoop API Documentation

Shoop Application API

See shoop.apps.

Shoop Packages and Modules

shoop package
Subpackages
shoop.admin package
Subpackages
shoop.admin.dashboard package
Submodules
shoop.admin.dashboard.blocks module
class shoop.admin.dashboard.blocks.DashboardBlock(id, size=None, color=None)[source]

Bases: object

SIZES = ('small', 'medium', 'large', 'full')
default_size = 'normal'
type = None
class shoop.admin.dashboard.blocks.DashboardChartBlock(id, size='normal')[source]

Bases: shoop.admin.dashboard.blocks.DashboardBlock

BLOCK_TEMPLATE = '\n <h2 class="block-title"><i class="fa fa-bar-chart"></i>%(title)s</h2>\n <div id="chart-%(id)s"></div>\n <script>\n window.CHART_CONFIGS = window.CHART_CONFIGS || {};\n window.CHART_CONFIGS["%(id)s"] = %(config)s;\n </script>\n '
default_size = 'medium'
get_chart()[source]

Get the actual chart instance for this block.

Returns:The chart (or None, if it can’t be rendered)
Return type:shoop.admin.dashboard.charts.Chart|None
type = 'chart'
class shoop.admin.dashboard.blocks.DashboardContentBlock(id, content, size='normal')[source]

Bases: shoop.admin.dashboard.blocks.DashboardBlock

classmethod by_rendering_template(id, request, template_name, context)[source]
type = 'normal'
class shoop.admin.dashboard.blocks.DashboardMoneyBlock(id, value, title, currency=None, **kwargs)[source]

Bases: shoop.admin.dashboard.blocks.DashboardValueBlock

class shoop.admin.dashboard.blocks.DashboardNumberBlock(id, value, title, **kwargs)[source]

Bases: shoop.admin.dashboard.blocks.DashboardValueBlock

class shoop.admin.dashboard.blocks.DashboardValueBlock(id, value, title, **kwargs)[source]

Bases: shoop.admin.dashboard.blocks.DashboardBlock

default_size = 'small'
type = 'value'
shoop.admin.dashboard.charts module
class shoop.admin.dashboard.charts.BarChart(title, labels)[source]

Bases: shoop.admin.dashboard.charts.Chart

add_data(name, data)[source]
get_config()[source]
class shoop.admin.dashboard.charts.Chart(title)[source]

Bases: object

get_config()[source]

Get a JSONable dictionary of configuration data for this chart. This is passed on as CHART_CONFIGS in the JS environment and eventually processed by dashboard-charts.js.

Returns:Dict of configuration
Return type:dict
get_config_json()[source]
shoop.admin.dashboard.utils module
shoop.admin.dashboard.utils.get_activity(request, n_entries=30, cutoff_hours=10)[source]

Get Activity objects from all modules as a list in latest-first order.

Parameters:
  • request (django.http.request.HttpRequest) – Request context
  • n_entries (int) – Number of entries to return in total.
  • cutoff_hours (float) – Calculate cutoff datetime so the oldest entry should be at most this old
Returns:

List of Activity objects

Return type:

list[Activity]

Module contents
class shoop.admin.dashboard.BarChart(title, labels)[source]

Bases: shoop.admin.dashboard.charts.Chart

add_data(name, data)[source]
get_config()[source]
class shoop.admin.dashboard.DashboardBlock(id, size=None, color=None)[source]

Bases: object

SIZES = ('small', 'medium', 'large', 'full')
default_size = 'normal'
type = None
class shoop.admin.dashboard.DashboardChartBlock(id, size='normal')[source]

Bases: shoop.admin.dashboard.blocks.DashboardBlock

BLOCK_TEMPLATE = '\n <h2 class="block-title"><i class="fa fa-bar-chart"></i>%(title)s</h2>\n <div id="chart-%(id)s"></div>\n <script>\n window.CHART_CONFIGS = window.CHART_CONFIGS || {};\n window.CHART_CONFIGS["%(id)s"] = %(config)s;\n </script>\n '
default_size = 'medium'
get_chart()[source]

Get the actual chart instance for this block.

Returns:The chart (or None, if it can’t be rendered)
Return type:shoop.admin.dashboard.charts.Chart|None
type = 'chart'
class shoop.admin.dashboard.DashboardContentBlock(id, content, size='normal')[source]

Bases: shoop.admin.dashboard.blocks.DashboardBlock

classmethod by_rendering_template(id, request, template_name, context)[source]
type = 'normal'
class shoop.admin.dashboard.DashboardMoneyBlock(id, value, title, currency=None, **kwargs)[source]

Bases: shoop.admin.dashboard.blocks.DashboardValueBlock

class shoop.admin.dashboard.DashboardNumberBlock(id, value, title, **kwargs)[source]

Bases: shoop.admin.dashboard.blocks.DashboardValueBlock

class shoop.admin.dashboard.DashboardValueBlock(id, value, title, **kwargs)[source]

Bases: shoop.admin.dashboard.blocks.DashboardBlock

default_size = 'small'
type = 'value'
shoop.admin.dashboard.get_activity(request, n_entries=30, cutoff_hours=10)[source]

Get Activity objects from all modules as a list in latest-first order.

Parameters:
  • request (django.http.request.HttpRequest) – Request context
  • n_entries (int) – Number of entries to return in total.
  • cutoff_hours (float) – Calculate cutoff datetime so the oldest entry should be at most this old
Returns:

List of Activity objects

Return type:

list[Activity]

shoop.admin.forms package
Submodules
shoop.admin.forms.fields module
class shoop.admin.forms.fields.PercentageField(max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs)[source]

Bases: django.forms.fields.DecimalField

MULTIPLIER = Decimal('100')
prepare_value(value)[source]
to_python(value)[source]
widget_attrs(widget)[source]
Module contents
shoop.admin.modules package
Subpackages
shoop.admin.modules.categories package
Subpackages
shoop.admin.modules.categories.views package
Submodules
shoop.admin.modules.categories.views.edit module
class shoop.admin.modules.categories.views.edit.CategoryBaseForm(**kwargs)[source]

Bases: shoop.utils.multilanguage_model_form.MultiLanguageModelForm

class Meta[source]

Bases: object

fields = ('parent', 'shops', 'status', 'ordering', 'visibility', 'visibility_groups', 'name', 'description', 'slug')
model

alias of Category

widgets = {'visibility': <class 'django.forms.widgets.RadioSelect'>, 'status': <class 'django.forms.widgets.RadioSelect'>}
CategoryBaseForm.base_fields = OrderedDict([('parent', <mptt.forms.TreeNodeChoiceField object at 0x7fde3ea80a20>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7fde3ea80ac8>), ('status', <enumfields.forms.EnumChoiceField object at 0x7fde3ea80da0>), ('ordering', <django.forms.fields.IntegerField object at 0x7fde3ea80e48>), ('visibility', <enumfields.forms.EnumChoiceField object at 0x7fde3ea80ef0>), ('visibility_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7fde3ea80f98>), ('name', <django.forms.fields.CharField object at 0x7fde3ea80048>), ('description', <django.forms.fields.CharField object at 0x7fde3ea807f0>), ('slug', <django.forms.fields.SlugField object at 0x7fde3ea80908>)])
CategoryBaseForm.declared_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3ea80048>), ('description', <django.forms.fields.CharField object at 0x7fde3ea807f0>), ('slug', <django.forms.fields.SlugField object at 0x7fde3ea80908>)])
CategoryBaseForm.media
class shoop.admin.modules.categories.views.edit.CategoryBaseFormPart(request, object=None)[source]

Bases: shoop.admin.form_part.FormPart

form_valid(form)[source]
get_form_defs()[source]
priority = -1000
class shoop.admin.modules.categories.views.edit.CategoryEditView(**kwargs)[source]

Bases: shoop.admin.form_part.SaveFormPartsMixin, shoop.admin.form_part.FormPartsViewMixin, shoop.admin.utils.views.CreateOrUpdateView

base_form_part_classes = [<class 'shoop.admin.modules.categories.views.edit.CategoryBaseFormPart'>]
context_object_name = 'category'
form_part_class_provide_key = 'admin_category_form_part'
form_valid(form)[source]
model

alias of Category

template_name = 'shoop/admin/categories/edit.jinja'
shoop.admin.modules.categories.views.list module
class shoop.admin.modules.categories.views.list.CategoryListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3ea8b2e8>, <shoop.admin.utils.picotable.Column object at 0x7fde3ea8b390>, <shoop.admin.utils.picotable.Column object at 0x7fde3ea8b438>, <shoop.admin.utils.picotable.Column object at 0x7fde3ea8b4a8>]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model

alias of Category

Module contents
class shoop.admin.modules.categories.views.CategoryEditView(**kwargs)[source]

Bases: shoop.admin.form_part.SaveFormPartsMixin, shoop.admin.form_part.FormPartsViewMixin, shoop.admin.utils.views.CreateOrUpdateView

base_form_part_classes = [<class 'shoop.admin.modules.categories.views.edit.CategoryBaseFormPart'>]
context_object_name = 'category'
form_part_class_provide_key = 'admin_category_form_part'
form_valid(form)[source]
model

alias of Category

template_name = 'shoop/admin/categories/edit.jinja'
class shoop.admin.modules.categories.views.CategoryListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3ea8b2e8>, <shoop.admin.utils.picotable.Column object at 0x7fde3ea8b390>, <shoop.admin.utils.picotable.Column object at 0x7fde3ea8b438>, <shoop.admin.utils.picotable.Column object at 0x7fde3ea8b4a8>]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model

alias of Category

Module contents
class shoop.admin.modules.categories.CategoryModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
category = <django.utils.functional.lazy.<locals>.__proxy__ object>
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_search_results(request, query)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.contacts package
Subpackages
shoop.admin.modules.contacts.views package
Submodules
shoop.admin.modules.contacts.views.detail module
class shoop.admin.modules.contacts.views.detail.ContactDetailToolbar(contact)[source]

Bases: shoop.admin.toolbar.Toolbar

build()[source]
build_new_user_button()[source]
build_renew_password_button()[source]
class shoop.admin.modules.contacts.views.detail.ContactDetailView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'contact'
get_context_data(**kwargs)[source]
model

alias of Contact

template_name = 'shoop/admin/contacts/detail.jinja'
shoop.admin.modules.contacts.views.edit module
class shoop.admin.modules.contacts.views.edit.AddressForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('prefix', 'name', 'suffix', 'name_ext', 'phone', 'email', 'street', 'street2', 'street3', 'postal_code', 'city', 'region_code', 'region', 'country')
model

alias of Address

AddressForm.base_fields = OrderedDict([('prefix', <django.forms.fields.CharField object at 0x7fde3e792f60>), ('name', <django.forms.fields.CharField object at 0x7fde3e792b00>), ('suffix', <django.forms.fields.CharField object at 0x7fde3e979278>), ('name_ext', <django.forms.fields.CharField object at 0x7fde3ea22240>), ('phone', <django.forms.fields.CharField object at 0x7fde3ea22588>), ('email', <django.forms.fields.EmailField object at 0x7fde3ea223c8>), ('street', <django.forms.fields.CharField object at 0x7fde3ea15e48>), ('street2', <django.forms.fields.CharField object at 0x7fde3ea15048>), ('street3', <django.forms.fields.CharField object at 0x7fde3ea06c50>), ('postal_code', <django.forms.fields.CharField object at 0x7fde3ea3d4e0>), ('city', <django.forms.fields.CharField object at 0x7fde3ea3d5f8>), ('region_code', <django.forms.fields.CharField object at 0x7fde3ea77b00>), ('region', <django.forms.fields.CharField object at 0x7fde3ea771d0>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7fde3ea77588>)])
AddressForm.declared_fields = OrderedDict()
AddressForm.media
class shoop.admin.modules.contacts.views.edit.ContactAddressesFormPart(request, object=None)[source]

Bases: shoop.admin.form_part.FormPart

form_valid(form)[source]
get_form_defs()[source]
priority = -900
class shoop.admin.modules.contacts.views.edit.ContactBaseForm(bind_user=None, *args, **kwargs)[source]

Bases: django.forms.models.BaseModelForm

This form is notoriously confusing in that it works in several different modes depending on what the instance being passed in is.

If the instance is an unsaved object, the form will show fields for the common superclass Contact as well as a type selection field. When saving the object, a _new_ instance is created, as its class will have been specialized into the actual concrete polymorphic type. (I said this is confusing.)

If the instance is a saved object, its type is checked and only the related fields are shown and none of that specialization stuff occurs.

FIELDS_BY_MODEL_NAME = {'PersonContact': ('gender', 'birth_date'), 'Contact': ('is_active', 'language', 'marketing_permission', 'phone', 'www', 'timezone', 'prefix', 'name', 'suffix', 'name_ext', 'email'), 'CompanyContact': ('vat_code',)}
generate_fields()[source]
save(commit=True)[source]
set_model_from_cleaned_data()[source]
class shoop.admin.modules.contacts.views.edit.ContactBaseFormPart(request, object=None)[source]

Bases: shoop.admin.form_part.FormPart

form_valid(form)[source]
get_form_defs()[source]
priority = -1000
class shoop.admin.modules.contacts.views.edit.ContactEditView(**kwargs)[source]

Bases: shoop.admin.form_part.SaveFormPartsMixin, shoop.admin.form_part.FormPartsViewMixin, shoop.admin.utils.views.CreateOrUpdateView

base_form_part_classes = [<class 'shoop.admin.modules.contacts.views.edit.ContactBaseFormPart'>, <class 'shoop.admin.modules.contacts.views.edit.ContactAddressesFormPart'>]
context_object_name = 'contact'
form_part_class_provide_key = 'admin_contact_form_part'
form_valid(form)[source]
get_toolbar()[source]
model

alias of Contact

template_name = 'shoop/admin/contacts/edit.jinja'
shoop.admin.modules.contacts.views.list module
class shoop.admin.modules.contacts.views.list.ContactListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e740160>, <shoop.admin.utils.picotable.Column object at 0x7fde3e7401d0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e740518>, <shoop.admin.utils.picotable.Column object at 0x7fde3e7404a8>, <shoop.admin.utils.picotable.Column object at 0x7fde3e7349b0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e734eb8>]
get_object_abstract(instance, item)[source]
get_queryset()[source]
get_type_display(instance)[source]
model

alias of Contact

shoop.admin.modules.contacts.views.reset module
class shoop.admin.modules.contacts.views.reset.ContactResetPasswordView(**kwargs)[source]

Bases: shoop.admin.modules.users.views.password.UserResetPasswordView

get_contact()[source]
get_object(queryset=None)[source]
get_success_url()[source]
Module contents
class shoop.admin.modules.contacts.views.ContactListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e740160>, <shoop.admin.utils.picotable.Column object at 0x7fde3e7401d0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e740518>, <shoop.admin.utils.picotable.Column object at 0x7fde3e7404a8>, <shoop.admin.utils.picotable.Column object at 0x7fde3e7349b0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e734eb8>]
get_object_abstract(instance, item)[source]
get_queryset()[source]
get_type_display(instance)[source]
model

alias of Contact

class shoop.admin.modules.contacts.views.ContactDetailView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'contact'
get_context_data(**kwargs)[source]
model

alias of Contact

template_name = 'shoop/admin/contacts/detail.jinja'
class shoop.admin.modules.contacts.views.ContactResetPasswordView(**kwargs)[source]

Bases: shoop.admin.modules.users.views.password.UserResetPasswordView

get_contact()[source]
get_object(queryset=None)[source]
get_success_url()[source]
class shoop.admin.modules.contacts.views.ContactEditView(**kwargs)[source]

Bases: shoop.admin.form_part.SaveFormPartsMixin, shoop.admin.form_part.FormPartsViewMixin, shoop.admin.utils.views.CreateOrUpdateView

base_form_part_classes = [<class 'shoop.admin.modules.contacts.views.edit.ContactBaseFormPart'>, <class 'shoop.admin.modules.contacts.views.edit.ContactAddressesFormPart'>]
context_object_name = 'contact'
form_part_class_provide_key = 'admin_contact_form_part'
form_valid(form)[source]
get_toolbar()[source]
model

alias of Contact

template_name = 'shoop/admin/contacts/edit.jinja'
Submodules
shoop.admin.modules.contacts.dashboard module
shoop.admin.modules.contacts.dashboard.get_active_customers_block(request)[source]
Module contents
class shoop.admin.modules.contacts.ContactModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
category = <django.utils.functional.lazy.<locals>.__proxy__ object>
get_dashboard_blocks(request)[source]
get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_search_results(request, query)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.demo package
Module contents
class shoop.admin.modules.demo.DemoModule[source]

Bases: shoop.admin.base.AdminModule

check_demo_optin(request)[source]

Check whether or not the user has opted in to see demo content. This may be toggled with ?demo=0 or ?demo=1, and it’s a persistent session flag.

Parameters:request (django.http.HttpRequest) – HTTP request
Returns:Opt-in flag
Return type:bool
get_activity(request, cutoff)[source]
get_dashboard_blocks(request)[source]
get_menu_entries(request)[source]
get_notifications(request)[source]
get_search_results(request, query)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.media package
Submodules
shoop.admin.modules.media.views module
class shoop.admin.modules.media.views.MediaBrowserView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

A view for browsing media.

Most of this is just a JSON API that the Javascript (static_src/media/browser) uses.

get(request, *args, **kwargs)[source]
handle_folder(data)[source]
handle_get_folders(data)[source]
handle_new_folder(data)[source]
handle_upload()[source]
post(request, *args, **kwargs)[source]
template_name = 'shoop/admin/media/browser.jinja'
title = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.media.views.handle_filedrop_upload(request)[source]

Squeeze out an UploadedFile from a request sent through FileDrop.js.

FileDrop.js’s AJAX mode passes the actual file data as an unembellished binary stream as the POST payload so we need to do some magic that normal (multipart/form-data) uploads would not require.

Here’s that magic.

Parameters:request (django.http.HttpRequest) – HTTP request.
Returns:Uploaded file.
Return type:django.core.files.uploadedfile.UploadedFile
Module contents
class shoop.admin.modules.media.MediaModule[source]

Bases: shoop.admin.base.AdminModule

A module for handling site media. Basically a frontend for the Django-Filer app.

get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.orders package
Subpackages
shoop.admin.modules.orders.views package
Submodules
shoop.admin.modules.orders.views.detail module
class shoop.admin.modules.orders.views.detail.OrderDetailView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'order'
get_context_data(**kwargs)[source]
get_toolbar()[source]
model

alias of Order

template_name = 'shoop/admin/orders/detail.jinja'
class shoop.admin.modules.orders.views.detail.OrderSetStatusView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get(request, *args, **kwargs)[source]
model

alias of Order

post(request, *args, **kwargs)[source]
shoop.admin.modules.orders.views.list module
class shoop.admin.modules.orders.views.list.OrderListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e3f8c50>, <shoop.admin.utils.picotable.Column object at 0x7fde3e3f8f98>, <shoop.admin.utils.picotable.Column object at 0x7fde3e3f8ef0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e444940>, <shoop.admin.utils.picotable.Column object at 0x7fde3e444c88>, <shoop.admin.utils.picotable.Column object at 0x7fde3e453a90>, <shoop.admin.utils.picotable.Column object at 0x7fde3e453fd0>]
format_order_date(instance, *args, **kwargs)[source]
format_taxful_total_price(instance, *args, **kwargs)[source]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model

alias of Order

shoop.admin.modules.orders.views.shipment module
class shoop.admin.modules.orders.views.shipment.OrderCreateShipmentView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

context_object_name = 'order'
form_class

alias of Form

form_valid(form)[source]
get_context_data(**kwargs)[source]
get_form(form_class=None)
get_form_kwargs()[source]
model

alias of Order

template_name = 'shoop/admin/orders/create_shipment.jinja'
Module contents
class shoop.admin.modules.orders.views.OrderDetailView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'order'
get_context_data(**kwargs)[source]
get_toolbar()[source]
model

alias of Order

template_name = 'shoop/admin/orders/detail.jinja'
class shoop.admin.modules.orders.views.OrderListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e3f8c50>, <shoop.admin.utils.picotable.Column object at 0x7fde3e3f8f98>, <shoop.admin.utils.picotable.Column object at 0x7fde3e3f8ef0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e444940>, <shoop.admin.utils.picotable.Column object at 0x7fde3e444c88>, <shoop.admin.utils.picotable.Column object at 0x7fde3e453a90>, <shoop.admin.utils.picotable.Column object at 0x7fde3e453fd0>]
format_order_date(instance, *args, **kwargs)[source]
format_taxful_total_price(instance, *args, **kwargs)[source]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model

alias of Order

class shoop.admin.modules.orders.views.OrderCreateShipmentView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

context_object_name = 'order'
form_class

alias of Form

form_valid(form)[source]
get_context_data(**kwargs)[source]
get_form(form_class=None)
get_form_kwargs()[source]
model

alias of Order

template_name = 'shoop/admin/orders/create_shipment.jinja'
class shoop.admin.modules.orders.views.OrderSetStatusView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get(request, *args, **kwargs)[source]
model

alias of Order

post(request, *args, **kwargs)[source]
Submodules
shoop.admin.modules.orders.dashboard module
class shoop.admin.modules.orders.dashboard.OrderValueChartDashboardBlock(id, size='normal')[source]

Bases: shoop.admin.dashboard.blocks.DashboardChartBlock

get_chart()[source]
shoop.admin.modules.orders.dashboard.get_avg_purchase_size_block(request)[source]
shoop.admin.modules.orders.dashboard.get_lifetime_sales_block(request)[source]
shoop.admin.modules.orders.dashboard.get_open_orders_block(request)[source]
shoop.admin.modules.orders.dashboard.get_order_value_chart_dashboard_block(request)[source]
shoop.admin.modules.orders.dashboard.get_sales_of_the_day_block(request)[source]
shoop.admin.modules.orders.dashboard.get_subtitle(count)[source]
Module contents
class shoop.admin.modules.orders.OrderModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
get_dashboard_blocks(request)[source]
get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_notifications(request)[source]
get_search_results(request, query)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.products package
Subpackages
shoop.admin.modules.products.views package
Submodules
shoop.admin.modules.products.views.edit module
class shoop.admin.modules.products.views.edit.ProductAttributeFormPart(request, object=None)[source]

Bases: shoop.admin.form_part.FormPart

form_valid(form)[source]
get_form_defs()[source]
priority = -800
class shoop.admin.modules.products.views.edit.ProductBaseFormPart(request, object=None)[source]

Bases: shoop.admin.form_part.FormPart

form_valid(form)[source]
get_form_defs()[source]
get_initial()[source]
priority = -1000
class shoop.admin.modules.products.views.edit.ProductEditView(**kwargs)[source]

Bases: shoop.admin.form_part.SaveFormPartsMixin, shoop.admin.form_part.FormPartsViewMixin, shoop.admin.utils.views.CreateOrUpdateView

base_form_part_classes = [<class 'shoop.admin.modules.products.views.edit.ProductBaseFormPart'>, <class 'shoop.admin.modules.products.views.edit.ShopProductFormPart'>, <class 'shoop.admin.modules.products.views.edit.ProductAttributeFormPart'>]
context_object_name = 'product'
form_part_class_provide_key = 'admin_product_form_part'
form_valid(form)[source]
get_toolbar()[source]
model

alias of Product

template_name = 'shoop/admin/products/edit.jinja'
class shoop.admin.modules.products.views.edit.ShopProductFormPart(request, object=None)[source]

Bases: shoop.admin.form_part.FormPart

form_valid(form)[source]
get_form_defs()[source]
get_shop_instance(shop)[source]
priority = -900
shoop.admin.modules.products.views.edit_media module
class shoop.admin.modules.products.views.edit_media.ProductMediaEditView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

A view for editing all the media for a product, including attachments that are not just images.

Currently sort of utilitarian and confusing.

context_object_name = 'product'
form_class

alias of ProductMediaFormSet

form_valid(form)[source]
get_breadcrumb_parents()[source]
get_context_data(**kwargs)[source]
get_form_kwargs()[source]
model

alias of Product

template_name = 'shoop/admin/products/edit_media.jinja'
class shoop.admin.modules.products.views.edit_media.ProductMediaForm(**kwargs)[source]

Bases: shoop.utils.multilanguage_model_form.MultiLanguageModelForm

class Meta[source]

Bases: object

fields = ('shops', 'kind', 'file', 'external_url', 'ordering', 'enabled', 'public', 'purchased', 'title', 'description')
model

alias of ProductMedia

ProductMediaForm.base_fields = OrderedDict([('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7fde3e20eeb8>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7fde3e2150b8>), ('file', <filer.fields.file.AdminFileFormField object at 0x7fde3e215160>), ('external_url', <django.forms.fields.URLField object at 0x7fde3e215358>), ('ordering', <django.forms.fields.IntegerField object at 0x7fde3e215470>), ('enabled', <django.forms.fields.BooleanField object at 0x7fde3e2154e0>), ('public', <django.forms.fields.BooleanField object at 0x7fde3e215588>), ('purchased', <django.forms.fields.BooleanField object at 0x7fde3e215630>), ('title', <django.forms.fields.CharField object at 0x7fde3e20ecc0>), ('description', <django.forms.fields.CharField object at 0x7fde3e20edd8>)])
ProductMediaForm.declared_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7fde3e20ecc0>), ('description', <django.forms.fields.CharField object at 0x7fde3e20edd8>)])
ProductMediaForm.media
ProductMediaForm.pre_master_save(instance)[source]
class shoop.admin.modules.products.views.edit_media.ProductMediaFormSet(*args, **kwargs)[source]

Bases: django.forms.models.BaseModelFormSet

absolute_max = 1000
can_delete = True
can_order = False
extra = 5
form(**kwargs)[source]
max_num = 1000
min_num = 0
model

alias of ProductMedia

validate_max = False
validate_min = False
shoop.admin.modules.products.views.list module
class shoop.admin.modules.products.views.list.ProductListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e215748>, <shoop.admin.utils.picotable.Column object at 0x7fde3e215828>, <shoop.admin.utils.picotable.Column object at 0x7fde3e215898>, <shoop.admin.utils.picotable.Column object at 0x7fde3e215908>]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model

alias of Product

Module contents
class shoop.admin.modules.products.views.ProductEditView(**kwargs)[source]

Bases: shoop.admin.form_part.SaveFormPartsMixin, shoop.admin.form_part.FormPartsViewMixin, shoop.admin.utils.views.CreateOrUpdateView

base_form_part_classes = [<class 'shoop.admin.modules.products.views.edit.ProductBaseFormPart'>, <class 'shoop.admin.modules.products.views.edit.ShopProductFormPart'>, <class 'shoop.admin.modules.products.views.edit.ProductAttributeFormPart'>]
context_object_name = 'product'
form_part_class_provide_key = 'admin_product_form_part'
form_valid(form)[source]
get_toolbar()[source]
model

alias of Product

template_name = 'shoop/admin/products/edit.jinja'
class shoop.admin.modules.products.views.ProductMediaEditView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

A view for editing all the media for a product, including attachments that are not just images.

Currently sort of utilitarian and confusing.

context_object_name = 'product'
form_class

alias of ProductMediaFormSet

form_valid(form)[source]
get_breadcrumb_parents()[source]
get_context_data(**kwargs)[source]
get_form_kwargs()[source]
model

alias of Product

template_name = 'shoop/admin/products/edit_media.jinja'
class shoop.admin.modules.products.views.ProductListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e215748>, <shoop.admin.utils.picotable.Column object at 0x7fde3e215828>, <shoop.admin.utils.picotable.Column object at 0x7fde3e215898>, <shoop.admin.utils.picotable.Column object at 0x7fde3e215908>]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model

alias of Product

class shoop.admin.modules.products.views.ProductDeleteView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'product'
get(request, *args, **kwargs)[source]
model

alias of Product

post(request, *args, **kwargs)[source]
Module contents
class shoop.admin.modules.products.ProductModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_search_results(request, query)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.taxes package
Subpackages
shoop.admin.modules.taxes.views package
Submodules
shoop.admin.modules.taxes.views.edit module
class shoop.admin.modules.taxes.views.edit.CustomerTaxGroupEditView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'customer_tax_group'
form_class

alias of CustomerTaxGroupForm

form_valid(form)[source]
model

alias of CustomerTaxGroup

template_name = 'shoop/admin/taxes/edit_customer_tax_group.jinja'
class shoop.admin.modules.taxes.views.edit.CustomerTaxGroupForm(**kwargs)[source]

Bases: shoop.utils.multilanguage_model_form.MultiLanguageModelForm

class Meta[source]

Bases: object

fields = ['name']
model

alias of CustomerTaxGroup

CustomerTaxGroupForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3e04bcc0>)])
CustomerTaxGroupForm.declared_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3e04bcc0>)])
CustomerTaxGroupForm.media
class shoop.admin.modules.taxes.views.edit.TaxClassEditView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'tax_class'
form_class

alias of TaxClassForm

form_valid(form)[source]
model

alias of TaxClass

template_name = 'shoop/admin/taxes/edit_tax_class.jinja'
class shoop.admin.modules.taxes.views.edit.TaxClassForm(**kwargs)[source]

Bases: shoop.utils.multilanguage_model_form.MultiLanguageModelForm

class Meta[source]

Bases: object

fields = ['name', 'enabled']
model

alias of TaxClass

TaxClassForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3e038eb8>), ('enabled', <django.forms.fields.BooleanField object at 0x7fde3e04c588>)])
TaxClassForm.declared_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3e038eb8>)])
TaxClassForm.media
class shoop.admin.modules.taxes.views.edit.TaxEditView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'tax'
form_class

alias of TaxForm

form_invalid(form)[source]
form_valid(form)[source]
model

alias of Tax

template_name = 'shoop/admin/taxes/edit_tax.jinja'
class shoop.admin.modules.taxes.views.edit.TaxForm(**kwargs)[source]

Bases: shoop.utils.multilanguage_model_form.MultiLanguageModelForm

class Meta[source]

Bases: object

fields = ['name', 'rate', 'amount', 'enabled']
model

alias of Tax

TaxForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3e04c5f8>), ('rate', <shoop.admin.forms.fields.PercentageField object at 0x7fde3e04c4a8>), ('amount', <django.forms.fields.DecimalField object at 0x7fde3e04bc88>), ('enabled', <django.forms.fields.BooleanField object at 0x7fde3e04bba8>)])
TaxForm.declared_fields = OrderedDict([('rate', <shoop.admin.forms.fields.PercentageField object at 0x7fde3e04c4a8>), ('name', <django.forms.fields.CharField object at 0x7fde3e04c5f8>)])
TaxForm.media
shoop.admin.modules.taxes.views.list module
class shoop.admin.modules.taxes.views.list.CustomerTaxGroupListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e04cb70>]
model

alias of CustomerTaxGroup

class shoop.admin.modules.taxes.views.list.TaxClassListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e04cc50>]
model

alias of TaxClass

class shoop.admin.modules.taxes.views.list.TaxListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e04c860>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04c940>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04c9b0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04ca20>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04ca90>]
model

alias of Tax

Module contents
class shoop.admin.modules.taxes.views.TaxClassListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e04cc50>]
model

alias of TaxClass

class shoop.admin.modules.taxes.views.TaxClassEditView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'tax_class'
form_class

alias of TaxClassForm

form_valid(form)[source]
model

alias of TaxClass

template_name = 'shoop/admin/taxes/edit_tax_class.jinja'
class shoop.admin.modules.taxes.views.TaxEditView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'tax'
form_class

alias of TaxForm

form_invalid(form)[source]
form_valid(form)[source]
model

alias of Tax

template_name = 'shoop/admin/taxes/edit_tax.jinja'
class shoop.admin.modules.taxes.views.TaxListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e04c860>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04c940>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04c9b0>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04ca20>, <shoop.admin.utils.picotable.Column object at 0x7fde3e04ca90>]
model

alias of Tax

class shoop.admin.modules.taxes.views.CustomerTaxGroupEditView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'customer_tax_group'
form_class

alias of CustomerTaxGroupForm

form_valid(form)[source]
model

alias of CustomerTaxGroup

template_name = 'shoop/admin/taxes/edit_customer_tax_group.jinja'
class shoop.admin.modules.taxes.views.CustomerTaxGroupListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e04cb70>]
model

alias of CustomerTaxGroup

Module contents
class shoop.admin.modules.taxes.TaxModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
category = <django.utils.functional.lazy.<locals>.__proxy__ object>
get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.users package
Subpackages
shoop.admin.modules.users.views package
Submodules
shoop.admin.modules.users.views.detail module
class shoop.admin.modules.users.views.detail.BaseUserForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

base_fields = OrderedDict([('password', <django.forms.fields.CharField object at 0x7fde3e727710>), ('permission_info', <django.forms.fields.CharField object at 0x7fde3e7275f8>)])
declared_fields = OrderedDict([('password', <django.forms.fields.CharField object at 0x7fde3e727710>), ('permission_info', <django.forms.fields.CharField object at 0x7fde3e7275f8>)])
media
save(commit=True)[source]
class shoop.admin.modules.users.views.detail.UserDetailToolbar(view)[source]

Bases: shoop.admin.toolbar.Toolbar

class shoop.admin.modules.users.views.detail.UserDetailView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'user'
dispatch(request, *args, **kwargs)[source]
fields = ('username', 'email', 'first_name', 'last_name')
form_valid(form)[source]
get_form_class()[source]
get_initial()[source]
get_success_url()[source]
get_toolbar()[source]
post(request, *args, **kwargs)[source]
template_name = 'shoop/admin/users/detail.jinja'
shoop.admin.modules.users.views.list module
class shoop.admin.modules.users.views.list.UserListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e727a58>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727b38>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727c18>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727240>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727390>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727320>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727208>]
get_context_data(**kwargs)[source]
get_model()[source]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model = 'auth.User'
shoop.admin.modules.users.views.password module
class shoop.admin.modules.users.views.password.PasswordChangeForm(changing_user, target_user, *args, **kwargs)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7fde3e79ae80>), ('password1', <django.forms.fields.CharField object at 0x7fde3e79a3c8>), ('password2', <django.forms.fields.CharField object at 0x7fde3e79ac50>)])
clean_old_password()[source]

Validates that the old_password field is correct.

clean_password2()[source]
declared_fields = OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7fde3e79ae80>), ('password1', <django.forms.fields.CharField object at 0x7fde3e79a3c8>), ('password2', <django.forms.fields.CharField object at 0x7fde3e79ac50>)])
error_messages = {'password_mismatch': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fde3e79a0b8>, 'password_incorrect': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fde3e79ad68>}
media
save(commit=True)[source]
class shoop.admin.modules.users.views.password.UserChangePasswordView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

form_class

alias of PasswordChangeForm

form_valid(form)[source]
get_context_data(**kwargs)[source]
get_form_kwargs()[source]
get_queryset()[source]
get_success_url()[source]
get_toolbar()[source]
model = 'auth.User'
template_name = 'shoop/admin/users/change_password.jinja'
title = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.admin.modules.users.views.password.UserResetPasswordView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get_queryset()[source]
get_success_url()[source]
model = 'auth.User'
post(request, *args, **kwargs)[source]
process_user(user)[source]
template_name = 'shoop/admin/users/reset_password.jinja'
title = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.admin.modules.users.views.permissions module
class shoop.admin.modules.users.views.permissions.PermissionChangeFormBase(changing_user, *args, **kwargs)[source]

Bases: django.forms.models.ModelForm

base_fields = OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7fde3e79a9e8>)])
clean()[source]
clean_old_password()[source]

Validates that the old_password field is correct.

declared_fields = OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7fde3e79a9e8>)])
media
class shoop.admin.modules.users.views.permissions.UserChangePermissionsView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

form_valid(form)[source]
get_context_data(**kwargs)[source]
get_form_class()[source]
get_form_kwargs()[source]
get_queryset()[source]
get_success_url()[source]
get_toolbar()[source]
model = 'auth.User'
template_name = 'shoop/admin/users/change_permissions.jinja'
title = <django.utils.functional.lazy.<locals>.__proxy__ object>
Module contents
class shoop.admin.modules.users.views.UserListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3e727a58>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727b38>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727c18>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727240>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727390>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727320>, <shoop.admin.utils.picotable.Column object at 0x7fde3e727208>]
get_context_data(**kwargs)[source]
get_model()[source]
get_object_abstract(instance, item)[source]
get_queryset()[source]
model = 'auth.User'
class shoop.admin.modules.users.views.UserDetailView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'user'
dispatch(request, *args, **kwargs)[source]
fields = ('username', 'email', 'first_name', 'last_name')
form_valid(form)[source]
get_form_class()[source]
get_initial()[source]
get_success_url()[source]
get_toolbar()[source]
post(request, *args, **kwargs)[source]
template_name = 'shoop/admin/users/detail.jinja'
class shoop.admin.modules.users.views.UserChangePasswordView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

form_class

alias of PasswordChangeForm

form_valid(form)[source]
get_context_data(**kwargs)[source]
get_form_kwargs()[source]
get_queryset()[source]
get_success_url()[source]
get_toolbar()[source]
model = 'auth.User'
template_name = 'shoop/admin/users/change_password.jinja'
title = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.admin.modules.users.views.UserResetPasswordView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get_queryset()[source]
get_success_url()[source]
model = 'auth.User'
post(request, *args, **kwargs)[source]
process_user(user)[source]
template_name = 'shoop/admin/users/reset_password.jinja'
title = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.admin.modules.users.views.UserChangePermissionsView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

form_valid(form)[source]
get_context_data(**kwargs)[source]
get_form_class()[source]
get_form_kwargs()[source]
get_queryset()[source]
get_success_url()[source]
get_toolbar()[source]
model = 'auth.User'
template_name = 'shoop/admin/users/change_permissions.jinja'
title = <django.utils.functional.lazy.<locals>.__proxy__ object>
Module contents
class shoop.admin.modules.users.UserModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
category = <django.utils.functional.lazy.<locals>.__proxy__ object>
get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_search_results(request, query)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
Module contents
shoop.admin.template_helpers package
Submodules
shoop.admin.template_helpers.shoop_admin module

This module is installed as the shoop_admin template function namespace.

shoop.admin.template_helpers.shoop_admin.get_menu_entry_categories(context)[source]
shoop.admin.template_helpers.shoop_admin.get_front_url(context)[source]
shoop.admin.template_helpers.shoop_admin.get_config(context)[source]
shoop.admin.template_helpers.shoop_admin.model_url(model, kind='detail', default=None)[source]

Get a model URL of the given kind for a model (instance or class).

Parameters:
  • model (django.db.Model) – The model instance or class.
  • kind (str) – The URL kind to retrieve. See get_model_url.
  • default (str|None) – Default value to return if model URL retrieval fails. If None, the NoModelUrl exception is (re)raised.
Returns:

URL string.

Return type:

str

Module contents
shoop.admin.templatetags package
Submodules
shoop.admin.templatetags.shoop_admin module
class shoop.admin.templatetags.shoop_admin.Bootstrap3Namespace[source]

Bases: object

field(field, **kwargs)[source]
form(form, **kwargs)[source]
Module contents
shoop.admin.utils package
Submodules
shoop.admin.utils.bs3_renderers module
class shoop.admin.utils.bs3_renderers.AdminFieldRenderer(field, **kwargs)[source]

Bases: bootstrap3.renderers.FieldRenderer

add_class_attrs()[source]
add_help_attrs()[source]
get_label()[source]
shoop.admin.utils.forms module
class shoop.admin.utils.forms.MediaChoiceField(queryset, empty_label='---------', cache_choices=None, required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, *args, **kwargs)[source]

Bases: django.forms.models.ModelChoiceField

widget

alias of MediaChoiceWidget

class shoop.admin.utils.forms.MediaChoiceWidget(attrs=None)[source]

Bases: django.forms.widgets.Widget

BROWSE_MARKUP = "<button class='media-browse btn btn-sm' type='button'><i class='fa fa-folder'></i> Browse</button>"
media
render(name, value, attrs=None)[source]
render_text(obj)[source]
shoop.admin.utils.forms.add_form_errors_as_messages(request, form)[source]

Add the form’s errors, if any, into the request as messages.

Parameters:
Returns:

Number of messages added. May be thousands, for a very unlucky form.

Return type:

int

shoop.admin.utils.forms.filter_form_field_choices(field, predicate, invert=False)[source]

Filter the choices of a given form field (and its widget) by the given predicate.

The predicate may be a callable of the signature (pair) -> bool or an iterable of allowable `value`s.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/shoop-1.1.0-py3.4.egg/shoop/admin/utils/forms.py:docstring of shoop.admin.utils.forms.filter_form_field_choices, line 4); backlink

Inline interpreted text or phrase reference start-string without end-string.
Parameters:
  • field (django.forms.Field) – Form field.
  • predicate (function|Iterable) – Predicate
  • invert (bool) – Invert the semantics of the predicate, i.e. items matching it will be rejected.
Returns:

Nothing. The field is modified in-place.

shoop.admin.utils.picotable module
class shoop.admin.utils.picotable.ChoicesFilter(choices=None, filter_field=None)[source]

Bases: shoop.admin.utils.picotable.Filter

filter_queryset(queryset, column, value)[source]
to_json(context)[source]
type = 'choices'
class shoop.admin.utils.picotable.Column(id, title, **kwargs)[source]

Bases: object

filter_queryset(queryset, value)[source]
get_display_value(context, object)[source]
sort_queryset(queryset, desc=False)[source]
to_json(context=None)[source]
class shoop.admin.utils.picotable.DateRangeFilter(*args, **kwargs)[source]

Bases: shoop.admin.utils.picotable.RangeFilter

filter_queryset(queryset, column, value)[source]
class shoop.admin.utils.picotable.Filter[source]

Bases: object

filter_queryset(queryset, column, value)[source]
to_json(context)[source]
type = None
class shoop.admin.utils.picotable.MultiFieldTextFilter(filter_fields, **kwargs)[source]

Bases: shoop.admin.utils.picotable.TextFilter

filter_queryset(queryset, column, value)[source]
class shoop.admin.utils.picotable.Picotable(request, columns, queryset, context)[source]

Bases: object

get_data(query)[source]
get_verbose_name_plural()[source]
process_item(object)[source]
process_queryset(query)[source]
class shoop.admin.utils.picotable.PicotableViewMixin[source]

Bases: object

columns = []
get(request, *args, **kwargs)[source]
get_object_abstract(instance, item)[source]

Get the object abstract lines (used for mobile layouts) for this object.

Supported keys in abstract line dicts are:

  • text (required)
  • title
  • class (CSS class name – header for instance)
  • raw (boolean; whether or not the text is raw HTML)
Parameters:
  • instance – The instance
  • item – The item dict so far. Useful for reusing precalculated values.
Returns:

Iterable of dicts to pass through to the picotable javascript

Return type:

Iterable[dict]

get_object_url(instance)[source]
picotable_class

alias of Picotable

process_picotable(query_json)[source]
template_name = 'shoop/admin/base_picotable.jinja'
class shoop.admin.utils.picotable.RangeFilter(min=None, max=None, step=None, field_type=None, filter_field=None)[source]

Bases: shoop.admin.utils.picotable.Filter

filter_queryset(queryset, column, value)[source]
to_json(context)[source]
type = 'range'
class shoop.admin.utils.picotable.TextFilter(field_type=None, placeholder=None, operator='icontains', filter_field=None)[source]

Bases: shoop.admin.utils.picotable.Filter

filter_queryset(queryset, column, value)[source]
to_json(context)[source]
type = 'text'
shoop.admin.utils.picotable.maybe_call(thing, context, args=None, kwargs=None)[source]

If thing is callable, call it with args and kwargs and return the value. If thing names a callable attribute of context, call it with args and kwargs and return the value. Otherwise return thing.

shoop.admin.utils.picotable.maybe_callable(thing, context=None)[source]

If thing is callable, return it. If thing names a callable attribute of context, return it.

shoop.admin.utils.search module
class shoop.admin.utils.search.FuzzyMatcher(query)[source]

Bases: object

test(text)[source]
shoop.admin.utils.search.split_query(query_string, minimum_part_length=3)[source]

Split a string into a set of non-empty words, none shorter than minimum_part_length characters.

Parameters:
  • query_string (str) – Query string
  • minimum_part_length (int) – Minimum part length
Returns:

Set of query parts

Return type:

set[str]

shoop.admin.utils.urls module
class shoop.admin.utils.urls.AdminRegexURLPattern(regex, callback, default_args=None, name=None, require_authentication=True, permissions=())[source]

Bases: django.core.urlresolvers.RegexURLPattern

callback
wrap_with_permissions(view_func)[source]
exception shoop.admin.utils.urls.NoModelUrl[source]

Bases: ValueError

shoop.admin.utils.urls.admin_url(regex, view, kwargs=None, name=None, prefix='', require_authentication=True, permissions=())[source]
shoop.admin.utils.urls.derive_model_url(model_class, urlname_prefix, object, kind)[source]

Try to guess a model URL for the given object and kind.

An utility for people implementing get_model_url.

Parameters:
  • model_class (class) – The model class the object must be an instance or subclass of.
  • urlname_prefix (str) – URLname prefix. For instance, shoop_admin:product.
  • object (django.db.models.Model|class) – The model or model class as passed to get_model_url
  • kind (str) – URL kind as passed to get_model_url.
Returns:

Resolved URL or None.

Return type:

str|None

shoop.admin.utils.urls.get_model_front_url(request, object)[source]

Get a frontend URL for an object.

Parameters:
Returns:

URL or None

Return type:

str|None

shoop.admin.utils.urls.get_model_url(object, kind='detail')[source]

Get a an admin object URL for the given object or object class by interrogating each admin module.

Raises NoModelUrl if lookup fails

Parameters:
  • object (class) – Model or object class.
  • kind (str) – URL kind. Currently “new”, “list”, “edit”, “detail”.
Returns:

Resolved URL.

Return type:

str

shoop.admin.utils.urls.manipulate_query_string(url, **qs)[source]
shoop.admin.utils.views module
class shoop.admin.utils.views.CreateOrUpdateView(**kwargs)[source]

Bases: django.views.generic.edit.UpdateView

get_context_data(**kwargs)[source]
get_form_kwargs()[source]
get_new_url()[source]
get_object(queryset=None)[source]
get_return_url()[source]
get_save_form_id()[source]
get_success_url()[source]
get_toolbar()[source]
class shoop.admin.utils.views.PicotableListView(**kwargs)[source]

Bases: shoop.admin.utils.picotable.PicotableViewMixin, django.views.generic.list.ListView

get_context_data(**kwargs)[source]
get_toolbar()[source]
shoop.admin.utils.views.add_create_or_change_message(request, instance, is_new)[source]
shoop.admin.utils.views.get_create_or_change_title(request, instance, name_field=None)[source]

Get a title suitable for an create-or-update view.

Parameters:
  • request (HttpRequest) – Request
  • instance (django.db.models.Model) – Model instance
  • name_field (str) – Which property to try to read the name from. If None, use str
Returns:

Title

Return type:

str

Module contents
shoop.admin.views package
Submodules
shoop.admin.views.dashboard module
class shoop.admin.views.dashboard.DashboardView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

get(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]
template_name = 'shoop/admin/dashboard/dashboard.jinja'
shoop.admin.views.menu module
class shoop.admin.views.menu.MenuView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

template_name = 'shoop/admin/base/_main_menu.jinja'
shoop.admin.views.search module
class shoop.admin.views.search.SearchView(**kwargs)[source]

Bases: django.views.generic.base.View

get(request, *args, **kwargs)[source]
shoop.admin.views.search.get_search_results(request, query)[source]
Module contents
Submodules
shoop.admin.base module
class shoop.admin.base.Activity(datetime, text, url=None)[source]

Bases: shoop.admin.base.Resolvable

class shoop.admin.base.AdminModule[source]

Bases: object

breadcrumbs_menu_entry = None
get_activity(request, cutoff)[source]
Parameters:
  • cutoff (datetime.datetime) – Cutoff datetime
  • request (django.http.request.HttpRequest) – Request
Returns:

list[shoop.admin.base.Activity]

get_dashboard_blocks(request)[source]
Return type:list[shoop.admin.dashboard.DashboardBlock]
get_menu_category_icons()[source]
Return type:dict[str,str]
get_menu_entries(request)[source]
Return type:list[shoop.admin.base.MenuEntry]
get_model_url(object, kind)[source]

Retrieve an admin URL for the given object of the kind kind.

A falsy value must be returned if the module does not know how to reverse the given object.

Parameters:
  • object (django.db.models.Model) – A object instance (or object class).
  • kind (str) – URL kind. Currently “detail”, “list” or “new”.
Returns:

The reversed URL or none.

Return type:

str|None

get_notifications(request)[source]
Return type:list[shoop.admin.base.Notification]
get_search_results(request, query)[source]
Return type:list[shoop.admin.base.SearchResult]
get_urls()[source]
Return type:list[django.core.urlresolvers.RegexURLPattern]
name = 'Base'
class shoop.admin.base.MenuEntry(text, url, icon=None, category=None, aliases=())[source]

Bases: shoop.admin.base.Resolvable

get_search_query_texts()[source]
class shoop.admin.base.Notification(text, title=None, url=None, kind='info', dismissal_url=None, datetime=None)[source]

Bases: shoop.admin.base.Resolvable

KINDS = ('info', 'success', 'warning', 'danger')
class shoop.admin.base.Resolvable[source]

Bases: object

original_url
url

Resolve this object’s _url to an actual URL.

Returns:URL or no URL.
Return type:str|None
class shoop.admin.base.SearchResult(text, url, icon=None, category=None, is_action=False, relevance=100)[source]

Bases: shoop.admin.base.Resolvable

to_json()[source]
shoop.admin.form_part module
class shoop.admin.form_part.FormPart(request, object=None)[source]

Bases: object

form_valid(form)[source]
get_form_defs()[source]
priority = 0
class shoop.admin.form_part.FormPartsViewMixin[source]

Bases: object

base_form_part_classes = ()
fields = ()
form_part_class_provide_key = None
get_form(form_class=None)[source]
get_form_class()[source]
get_form_part_classes()[source]
get_form_parts(object)[source]
request = None
class shoop.admin.form_part.SaveFormPartsMixin[source]

Bases: object

object = None
request = None
save_form_parts(form)[source]
class shoop.admin.form_part.TemplatedFormDef(name, form_class, template_name, required=True, kwargs=None)[source]

Bases: shoop.utils.form_group.FormDef

shoop.admin.menu module
shoop.admin.menu.get_menu_entry_categories(request)[source]
shoop.admin.module_registry module
shoop.admin.module_registry.discover()[source]
shoop.admin.module_registry.get_module_urls()[source]
shoop.admin.module_registry.get_modules()[source]
Return type:list[shoop.admin.base.AdminModule]
shoop.admin.module_registry.register(module_class)[source]
shoop.admin.module_registry.replace_modules(new_module_classes)[source]

Context manager to temporarily replace all modules with something else.

Test utility, mostly.

>>> def some_test():
...     with replace_modules(["foo.bar:QuuxModule"]):
...         pass # do stuff
Parameters:new_module_classes – Iterable of module classes, like you’d pass to register
shoop.admin.toolbar module
class shoop.admin.toolbar.BaseActionButton(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default')[source]

Bases: object

base_css_classes = ('btn',)
get_computed_class()[source]
render(request)[source]

Yield HTML bits for this object. :type request: HttpRequest :rtype: Iterable[str]

render_label()[source]
class shoop.admin.toolbar.ButtonGroup[source]

Bases: list

render(request)[source]
class shoop.admin.toolbar.DropdownActionButton(items, split_button=None, **kwargs)[source]

Bases: shoop.admin.toolbar.BaseActionButton

An action button with a chevron button to open a dropdown menu.

base_css_classes = ('btn', 'dropdown-toggle')
render(request)[source]
render_dropdown(request)[source]
class shoop.admin.toolbar.DropdownDivider(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default')[source]

Bases: shoop.admin.toolbar.BaseActionButton

A Divider for DropdownActionButtons.

base_css_classes = ()
render(request)[source]
class shoop.admin.toolbar.DropdownItem(url='#', onclick=None, **kwargs)[source]

Bases: shoop.admin.toolbar.BaseActionButton

An item to be shown in a DropdownActionButton.

base_css_classes = ()
render(request)[source]
class shoop.admin.toolbar.JavaScriptActionButton(onclick, **kwargs)[source]

Bases: shoop.admin.toolbar.BaseActionButton

An action button that uses onclick for action dispatch.

render(request)[source]
class shoop.admin.toolbar.NewActionButton(url, **kwargs)[source]

Bases: shoop.admin.toolbar.URLActionButton

An URL button with sane “new” visual semantics

classmethod for_model(model, **kwargs)[source]

Generate a NewActionButton for a model, auto-wiring the URL.

Parameters:model – Model class
Return type:shoop.admin.toolbar.NewActionButton|None
class shoop.admin.toolbar.PostActionButton(post_url=None, name=None, value=None, form_id=None, confirm=None, **kwargs)[source]

Bases: shoop.admin.toolbar.BaseActionButton

An action button that renders as a button POSTing a form containing name`=`value to post_url.

render(request)[source]
class shoop.admin.toolbar.Toolbar[source]

Bases: list

render(request)[source]
render_to_string(request)[source]
class shoop.admin.toolbar.URLActionButton(url, **kwargs)[source]

Bases: shoop.admin.toolbar.BaseActionButton

An action button that renders as a link leading to url.

render(request)[source]
shoop.admin.toolbar.flatatt_filter(attrs)[source]
shoop.admin.toolbar.get_default_edit_toolbar(view_object, save_form_id, discard_url=None, delete_url=None, with_split_save=True, toolbar=None)[source]

Get a toolbar with buttons used for object editing.

Parameters:
  • view_object (django.views.generic.UpdateView) – The class-based-view object requiring the toolbar
  • save_form_id (str) – The DOM ID to target for the save button
  • discard_url (str|None) – The URL/route name for the Discard button. Falsy values default to the request URL.
  • delete_url (str|None) – The URL/route name for the Delete button. If this is not set, the delete button is not shown.
  • with_split_save (bool) – Use split delete button with “Save and Exit” etc.?
  • toolbar (Toolbar) – The toolbar to augment. If None, a new one is created.
Returns:

Toolbar

Return type:

Toolbar

shoop.admin.toolbar.get_discard_button(discard_url)[source]
shoop.admin.toolbar.try_reverse(viewname, **kwargs)[source]
shoop.admin.urls module
shoop.admin.urls.get_urls()[source]
shoop.admin.urls.login(request, **kwargs)[source]
Module contents
class shoop.admin.ShoopAdminAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_admin'
name = 'shoop.admin'
provides = {'admin_module': ['shoop.admin.modules.system:SystemModule', 'shoop.admin.modules.products:ProductModule', 'shoop.admin.modules.product_types:ProductTypeModule', 'shoop.admin.modules.media:MediaModule', 'shoop.admin.modules.orders:OrderModule', 'shoop.admin.modules.taxes:TaxModule', 'shoop.admin.modules.categories:CategoryModule', 'shoop.admin.modules.contacts:ContactModule', 'shoop.admin.modules.contact_groups:ContactGroupModule', 'shoop.admin.modules.users:UserModule', 'shoop.admin.modules.methods:MethodModule', 'shoop.admin.modules.attributes:AttributeModule', 'shoop.admin.modules.demo:DemoModule']}
ready()[source]
required_installed_apps = ['bootstrap3']
verbose_name = 'Shoop Admin'
shoop.apps package
Submodules
shoop.apps.provides module

This module contains the API to deal with the Provides system.

The Provides system is Shoop’s mechanism for discovering and loading components, both first-party and third-party.

See also

See The Provides system for further information about the Provides system.

shoop.apps.provides.clear_provides_cache()[source]
shoop.apps.provides.get_identifier_to_object_map(category)[source]
shoop.apps.provides.get_identifier_to_spec_map(category)[source]
shoop.apps.provides.get_provide_objects(category)[source]

Get an iterable of provide objects for the given category.

Parameters:category (str) – Category to load objects for
Returns:Iterable of objects
Return type:Iterable[object]
shoop.apps.provides.get_provide_specs_and_objects(category)[source]

Get a mapping of provide specs (“x.y.z:Q”) to their loaded objects (<class Q>).

Parameters:category (str) – Category to load objects for
Returns:Dict of spec -> object
Return type:dict[str, object]
shoop.apps.provides.load_module(setting_name, provide_category)[source]

Load a module from a module setting.

The value of the setting must be a module identifier for the given provide category.

Parameters:
  • setting_name (str) – The setting name for the identifier
  • provide_category (str) – The provide category for the identifier lookup (e.g. tax_module)
Returns:

An object.

Return type:

object

shoop.apps.provides.override_provides(category, spec_list)[source]

Context manager to override provides for a given category.

Useful for testing.

Parameters:
  • category (str) – Category name.
  • spec_list (list[str]) – List of specs.
shoop.apps.settings module
class shoop.apps.settings.Setting(name, default, app_name, module)[source]

Bases: object

shoop.apps.settings.collect_settings(app_name, settings_module)[source]
shoop.apps.settings.collect_settings_from_app(app_config)[source]
shoop.apps.settings.get_known_settings()[source]

Get all settings known to Shoop.

Return type:Iterable[Setting]
shoop.apps.settings.validate_templates_configuration()[source]

Validate the TEMPLATES configuration in the Django settings.

Shoop’s admin and default frontend require some Django-Jinja configuration, so let’s make sure clients configure their projects correctly.

Raises:Raises ImproperlyConfigured if the configuration does not seem valid.
Returns:
Return type:
Module contents
Shoop Application API

Every Shoop Application should define an app config class derived from shoop.apps.AppConfig.

Settings

To define settings for a Shoop Application, add a settings.py file to your app and define each setting as a module level variable with uppercase name. The values of these setting variables will be used as the default values for the settings. To document a setting, add a special comment block using ‘#: ‘ prefixed lines just before the setting assignment line.

Default values can then be changed normally by defining the changed value in your Django settings module. To read a value of a setting use the django.conf.settings interface.

For example, if a fancy app lives in a Python package named fancyapp, its settings will be in module fancyapp.settings and if it contains something like this

#: Number of donuts to use
#:
#: Must be less than 42.
FANCYAPP_NUMBER_OF_DONUTS = 3

then this would define a setting FANCYAPP_NUMBER_OF_DONUTS with a default value of 3.

See also source code of shoop.core.settings.

Naming Settings

Applications in Shoop Base distribution should use the following rules for naming their settings.

  1. Each setting should be prefixed with the string SHOOP_
  2. Boolean toggle settings should have a verb in imperative mood as part of the name, e.g. SHOOP_ALLOW_ANONYMOUS_ORDERS, SHOOP_ENABLE_ATTRIBUTES or SHOOP_ENABLE_MULTIPLE_SHOPS.
  3. Setting that is used to locate a replaceable module should have suffix _SPEC or _SPECS (if the setting is a list or mapping of those), e.g. SHOOP_PRICING_MODULE_SPEC.
  4. Setting names do NOT have to be prefixed with the application name. For example, SHOOP_BASKET_VIEW_SPEC which is not prefixed with SHOOP_FRONT even though it is from shoop.front application.
  5. Setting names should be unique; if two applications define a setting with a same name, they cannot be enabled in the same installation.

Warning

When you have a settings file your_app/settings.py, do not import Django’s settings in your_app/__init__.py with

from django.conf import settings

since that will make your_app.settings ambiguous. It may point to django.conf.settings when your_app.settings is not yet imported, or when it is imported, it will point to module defined by your_app/settings.py.

class shoop.apps.AppConfig(*args, **kwargs)[source]

Bases: django.apps.config.AppConfig

default_settings_module = '.settings'

Name of the settings module for this app

get_default_settings_module()[source]

Get default settings module.

Returns:the settings module
Raises:ImportError if no such module exists
provides = {}

See provides for details about the provides variable.

required_installed_apps = ()

Apps that are required to be in INSTALLED_APPS for this app

This may also be a dict of the form {app_name: reason} where the reason will then be listed in the ImproperlyConfigured exception.

shoop.apps.get_known_settings()[source]

Get all settings known to Shoop.

Return type:Iterable[Setting]
shoop.core package
Subpackages
shoop.core.fields package
Module contents
class shoop.core.fields.InternalIdentifierField(**kwargs)[source]

Bases: django.db.models.fields.CharField

get_prep_value(value)[source]
class shoop.core.fields.LanguageField(*args, **kwargs)[source]

Bases: django.db.models.fields.CharField

LANGUAGE_CODES = {'efi', 'eu', 'sbp', 'ne', 'got', 'tum', 'mgo', 've', 'sa', 'kok', 'ku', 'bkm', 'rn', 'syr', 'frm', 'grc', 'kaw', 'pa', 'ts', 'sr', 'non', 'tr', 'wak', 'kro', 'znd', 'akk', 'iu', 'fiu', 'hmn', 'ie', 'kr', 'niu', 'jgo', 'cad', 'ii', 'day', 'roa', 'pra', 'chp', 'luo', 'seh', 'sem', 'arn', 'fi', 'anp', 'dv', 'en', 'asa', 'nai', 'nic', 'zza', 'bbj', 'ada', 'nv', 'kum', 'kcg', 'agq', 'ta', 'moh', 'ady', 'arc', 'gd', 'fur', 'dak', 'gaa', 'sba', 'enm', 'phn', 'nwc', 'chr', 'mo', 'shu', 'srr', 'eo', 'lag', 'kbl', 'ss', 'ksf', 'ki', 'mn', 'min', 'bla', 'dje', 'mis', 'nus', 'goh', 'am', 'ain', 'ln', 'io', 'tyv', 'fy', 'scn', 'ee', 'nap', 'lt', 'swc', 'de', 'xal', 'tg', 'pon', 'cel', 'be', 'vun', 'zun', 'gay', 'oto', 'paa', 'lui', 'lg', 'se', 'sga', 'lb', 'nah', 'st', 'bn', 'tn', 'kw', 'sms', 'mt', 'eka', 'sla', 'lol', 'et', 'es_ES', 'ug', 'wen', 'na', 'ssy', 'sw', 'kar', 'mgh', 'mua', 'gsw', 'mga', 'kru', 'qu', 'yue', 'smj', 'kam', 'gon', 'byv', 'pap', 'map', 'mfe', 'pag', 'sam', 'wa', 'sc', 'tem', 'csb', 'fa', 'del', 'tlh', 'btk', 'loz', 'sgn', 'mus', 'alg', 'kpe', 'ota', 'lo', 'mdr', 'crp', 'pro', 'sq', 'mno', 'mwr', 'cu', 'kde', 'kkj', 'bum', 'iba', 'dsb', 'den', 'raj', 'snk', 'uz', 'tog', 'ksb', 'man', 'phi', 'nso', 'bi', 'nzi', 'rap', 'dav', 'cpf', 'new', 'chk', 'mg', 'bs', 'ace', 'ses', 'krc', 'tk', 'aa', 'bal', 'inc', 'fro', 'mh', 'crh', 'zh_Hant', 'lun', 'awa', 'teo', 'bad', 'ilo', 'war', 'kl', 'zxx', 'cay', 'nd', 'km', 'ypk', 'an', 'kfo', 'nub', 'el', 'nr', 'zbl', 'mdf', 'cgg', 'hai', 'iro', 'dz', 'xog', 'ms', 'dgr', 'sid', 'gba', 'de_AT', 'lez', 'ae', 'mak', 'os', 'co', 'ceb', 'chn', 'cs', 'swb', 'sl', 'yap', 'und', 'nn', 'root', 'jv', 'kut', 'twq', 'frr', 'ga', 'it', 'kn', 'so', 'sal', 'tup', 'is', 'sel', 'ca', 'uga', 'kv', 'nb', 'th', 'ban', 'bh', 'ath', 'son', 'kg', 'nl', 'yo', 'ur', 'tmh', 'hz', 'apa', 'ab', 'bez', 'hi', 'mk', 'trv', 'mde', 'shi', 'pt_BR', 'dra', 'cus', 'pt', 'pi', 'ky', 'ber', 'mul', 'gil', 'tzm', 'bug', 'uk', 'arw', 'ar_001', 'umb', 'ay', 'fan', 'mni', 'jpr', 'en_CA', 'ks', 'lah', 'mai', 'hu', 'ps', 'shn', 'sg', 'fr_CA', 'ny', 'suk', 'art', 'sh', 'fon', 'haw', 'grb', 'sit', 'nqo', 'ko', 'khq', 'lus', 'kea', 'ia', 'av', 'nyo', 'en_GB', 'ro', 'no', 'za', 'sma', 'wal', 'sux', 'az', 'mnc', 'ch', 'pam', 'dyu', 'him', 'luy', 'brx', 'sai', 'id', 'egy', 'ha', 'din', 'mye', 'afh', 'es', 'kab', 'rar', 'cop', 'tkl', 'fr_CH', 'syc', 'cy', 'hr', 'guz', 'krl', 'chm', 'naq', 'tw', 'lu', 'bai', 'ibb', 'lv', 'mr', 'hup', 'li', 'ml', 'mwl', 'aus', 'rup', 'cau', 'alt', 'hy', 'sk', 'smi', 'elx', 'gu', 'to', 'ff', 'cai', 'ter', 'chb', 'hil', 'tsi', 'gwi', 'tiv', 'was', 'ar', 'tut', 'cho', 'en_AU', 'vi', 'mun', 'rwk', 'ik', 'kbd', 'lkt', 'arp', 'mic', 'fo', 'byn', 'lam', 'udm', 'he', 'ssa', 'kha', 'en_US', 'kos', 'sd', 'gor', 'sog', 'rom', 'ale', 'yao', 'fj', 'es_419', 'te', 'doi', 'bg', 'kho', 'af', 'cpe', 'zap', 'br', 'ckb', 'vo', 'ybb', 'ho', 'chy', 'kln', 'inh', 'ht', 'sat', 'kj', 'wo', 'frs', 'pal', 'kk', 'chg', 'bin', 'tvl', 'kaj', 'sus', 'fr', 'dzg', 'zh_Hans', 'nyn', 'mos', 'nds', 'my', 'yi', 'si', 'mag', 'tli', 'kac', 'men', 'nym', 'gn', 'bej', 'sco', 'pau', 'cpp', 'nmg', 'mkh', 'bho', 'cch', 'ewo', 'sad', 'afa', 'de_CH', 'ang', 'jrb', 'kaa', 'dua', 'dar', 'ine', 'ak', 'lad', 'cv', 'sas', 'gez', 'mas', 'oc', 'tpi', 'ksh', 'tai', 'ru', 'maf', 'mad', 'myn', 'nnh', 'ja', 'srn', 'hit', 'mer', 'su', 'bnt', 'smn', 'bem', 'ng', 'yav', 'cmc', 'ijo', 'ebu', 'fat', 'bik', 'zu', 'jbo', 'oj', 'ty', 'nog', 'bss', 'lua', 'sah', 'ira', 'bfd', 'gmh', 'bra', 'rof', 'bax', 'tig', 'ba', 'osa', 'car', 'myv', 'rm', 'bua', 'jmc', 'nia', 'khi', 'nl_BE', 'xh', 'bat', 'sn', 'da', 'dyo', 'ast', 'fil', 'gem', 'om', 'vai', 'saq', 'ti', 'kmb', 'dum', 'la', 'zh', 'tt', 'or', 'hsb', 'vot', 'gl', 'as', 'pt_PT', 'sm', 'rw', 'bas', 'ce', 'see', 'gv', 'ach', 'ig', 'sio', 'sv', 'tet', 'wae', 'peo', 'bm', 'pl', 'zen', 'ka', 'cr', 'tl', 'bo', 'mi'}
get_choices(include_blank=True, blank_choice=[('', '---------')])[source]
class shoop.core.fields.MeasurementField(unit, **kwargs)[source]

Bases: django.db.models.fields.DecimalField

KNOWN_UNITS = ('mm', 'm', 'kg', 'g', 'm3')
deconstruct()[source]
class shoop.core.fields.MoneyField(**kwargs)[source]

Bases: django.db.models.fields.DecimalField

class shoop.core.fields.QuantityField(**kwargs)[source]

Bases: django.db.models.fields.DecimalField

class shoop.core.fields.TaggedJSONField(*args, **kwargs)[source]

Bases: jsonfield.fields.JSONField

contribute_to_class(cls, name)
class shoop.core.fields.UnsavedForeignKey(to, to_field=None, rel_class=<class 'django.db.models.fields.related.ManyToOneRel'>, db_constraint=True, **kwargs)[source]

Bases: django.db.models.fields.related.ForeignKey

allow_unsaved_instance_assignment = True
shoop.core.management package
Subpackages
shoop.core.management.commands package
Submodules
shoop.core.management.commands.shoop_show_settings module

Show known Shoop settings and their values.

class shoop.core.management.commands.shoop_show_settings.Command(stdout=None, stderr=None, no_color=False)[source]

Bases: django.core.management.base.BaseCommand

handle(*args, **options)[source]
help = 'Show known Shoop settings and their values.'
option_list = (<Option at 0x7fde3da465f8: --only-changed>,)
Module contents
Module contents
shoop.core.methods package
Submodules
shoop.core.methods.base module
class shoop.core.methods.base.BaseMethodModule(method, options)[source]

Bases: object

Base method module implementation.

admin_detail_view_class = None
checkout_phase_class = None
get_effective_name(source, **kwargs)[source]

Return the effective name for this method. Useful to add shipping mode (“letter”, “parcel”) for instance.

Parameters:
  • source – source object
  • kwargs – Other kwargs for future expansion
Returns:

name

Return type:

unicode

get_effective_price(source, **kwargs)[source]

Return the effective price.

Parameters:
Returns:

taxless or taxful price

Return type:

shoop.core.pricing.Price

get_options()[source]
get_source_lines(source)[source]
get_validation_errors(source, **kwargs)[source]

Return an iterable of human-readable errors (either Django’s ValidationError`s or just plain old strings) if there are any errors that would prevent using this method with a given `source.

This (instead of raising an error) broadly follows the Notification pattern. http://martinfowler.com/eaaDev/Notification.html

Parameters:
  • source – source object
  • kwargs – Other kwargs for future expansion
Returns:

Iterable of errors

Return type:

Iterable[str]

identifier = None
name = None
option_fields = [('price', <django.forms.fields.DecimalField object at 0x7fde3da46b38>), ('price_waiver_product_minimum', <django.forms.fields.DecimalField object at 0x7fde3da46588>)]
class shoop.core.methods.base.BasePaymentMethodModule(method, options)[source]

Bases: shoop.core.methods.base.BaseMethodModule

Base payment method module implementation.

get_payment_process_response(order, urls)[source]
process_payment_return_request(order, request)[source]
class shoop.core.methods.base.BaseShippingMethodModule(method, options)[source]

Bases: shoop.core.methods.base.BaseMethodModule

Base shipping method module implementation.

get_validation_errors(source, **kwargs)[source]
no_lower_limit_text = <django.utils.functional.lazy.<locals>.__proxy__ object>
option_fields = [('price', <django.forms.fields.DecimalField object at 0x7fde3da46b38>), ('price_waiver_product_minimum', <django.forms.fields.DecimalField object at 0x7fde3da46588>), ('min_weight', <django.forms.fields.DecimalField object at 0x7fde3dab3b38>), ('max_weight', <django.forms.fields.DecimalField object at 0x7fde3dab36d8>)]
shoop.core.methods.default module
class shoop.core.methods.default.DefaultPaymentMethodModule(method, options)[source]

Bases: shoop.core.methods.base.BasePaymentMethodModule

identifier = 'default_payment'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.core.methods.default.DefaultShippingMethodModule(method, options)[source]

Bases: shoop.core.methods.base.BaseShippingMethodModule

identifier = 'default_shipping'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.core.methods.ui module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.methods.rst, line 26)

autodoc: failed to import module ‘shoop.core.methods.ui’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 385, in import_object __import__(self.modname) ImportError: No module named ‘shoop.core.methods.ui’
Module contents
shoop.core.models package
Submodules
shoop.core.models.addresses module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 10)

autodoc: failed to import attribute ‘Address.country’ from module ‘shoop.core.models.addresses’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/django_countries-3.3-py3.4.egg/django_countries/fields.py”, line 111, in __get__ % (self.field.name, owner.__name__)) AttributeError: The ‘country’ attribute can only be accessed from Address instances. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: country
class shoop.core.models.addresses.Address(id, prefix, name, suffix, name_ext, company_name, vat_code, phone, email, street, street2, street3, postal_code, city, region_code, region, country, is_immutable)[source]

Bases: shoop.core.utils.name_mixin.NameMixin, django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Address.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Address.as_string_list(locale=None)[source]
Address.billing_orders
Address.copy()[source]
Address.get_country_display(*moreargs, **morekwargs)
Address.is_european_union
Address.is_home
Address.objects = <shoop.core.models.addresses.AddressManager object>
Address.save(*args, **kwargs)[source]
Address.saved_addresses
Address.set_immutable()[source]
Address.shipping_orders
class shoop.core.models.addresses.AddressManager[source]

Bases: django.db.models.manager.Manager

from_address_form(address_form, company=None)[source]

Get an address from an AddressForm (or similar-enough ModelForm).

May return an existing immutable address, or a new, unsaved address.

Parameters:
  • address_form (django.forms.ModelForm) – Address form.
  • company (shoop.shop.models.contacts.CompanyContact) – Optional CompanyContact object. If passed, the company information will be injected into the address.
Returns:

Address

try_get_exactly_like(object, ignore_fields=())[source]

Try to find an immutable Address that is data-wise exactly like the given object.

Parameters:
  • object (Address|models.Model) – A model – probably an Address
  • ignore_fields (Iterable[str]) – Iterable of field names to ignore while comparing.
Returns:

Address|None

class shoop.core.models.addresses.SavedAddress(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Model for saving multiple addresses in an ‘address book’ of sorts.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SavedAddress.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SavedAddress.address
SavedAddress.get_role_display(*moreargs, **morekwargs)
SavedAddress.get_status_display(*moreargs, **morekwargs)
SavedAddress.get_title()[source]

Returns the display title for this SavedAddress instance. Defaults to a short representation of the address.

This method should be used instead of accessing the title field directly when displaying SavedAddress objects.

SavedAddress.objects = <shoop.core.models.addresses.SavedAddressManager object>
SavedAddress.owner
SavedAddress.role

A placeholder class that provides a way to set the attribute on the model.

SavedAddress.status

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.addresses.SavedAddressManager[source]

Bases: django.db.models.manager.Manager

Custom manager for SavedAddress objects.

for_owner(owner)[source]

Returns a QuerySet containing SavedAddress objects whose owner is the given owner.

class shoop.core.models.addresses.SavedAddressRole[source]

Bases: enumfields.enums.Enum

class shoop.core.models.addresses.SavedAddressStatus[source]

Bases: enumfields.enums.Enum

shoop.core.models.attributes module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 18)

autodoc: failed to import attribute ‘AppliedAttribute.objects’ from module ‘shoop.core.models.attributes’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/Django-1.8.2-py3.4.egg/django/db/models/manager.py”, line 264, in __get__ self.model._meta.object_name, AttributeError: Manager isn’t available; AppliedAttribute is abstract During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: objects
class shoop.core.models.attributes.AppliedAttribute(*args, **kwargs)[source]

Bases: parler.models.TranslatableModel

class Meta[source]

Bases: object

abstract = False
AppliedAttribute.attribute
AppliedAttribute.formatted_value

Get a human-consumable value for the attribute.

The current locale is used for formatting.

Returns:Textual value
Return type:str
AppliedAttribute.name

Get the name of the underlying attribute in the current language.

AppliedAttribute.value
class shoop.core.models.attributes.AttributableMixin[source]

Bases: object

classmethod cache_attributes_for_targets(applied_attr_cls, targets, attribute_identifiers, language)[source]
clear_attribute_cache()[source]
get_all_attribute_info(language=None, visibility_mode=None)[source]
get_attribute_value(identifier, language=None, default=None)[source]

Get the value of the attribute with the identifier string identifier in the given (or current) language.

If the attribute is not found, return default.

Parameters:
  • identifier (str) – Attribute identifier
  • language (str|None) – Language identifier (or None for “current”)
  • default (object) – Default value to return
Returns:

Attribute value (or fallback)

Return type:

object

get_available_attribute_queryset()[source]
set_attribute_value(identifier, value, language=None)[source]

Set an attribute value.

Parameters:
  • identifier (str) – Attribute identifier
  • value (object) – The value for the attribute (should be in the correct type for the attribute).
  • language (str) – Language for multi-language attributes. Not required for untranslated attributes.
Returns:

Applied attribute object or None

Return type:

AppliedAttribute|None

class shoop.core.models.attributes.Attribute(id, identifier, searchable, type, visibility_mode)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Attribute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Attribute.formfield(**kwargs)[source]

Get a form field for this attribute.

Parameters:kwargs – Kwargs to pass for the form field class.
Returns:Form field.
Return type:forms.Field
Attribute.get_type_display(*moreargs, **morekwargs)
Attribute.get_visibility_mode_display(*moreargs, **morekwargs)
Attribute.is_null_value(value)[source]

Find out whether the given value is null from this attribute’s point of view.

Parameters:value (object) – A value
Returns:Nulliness boolean
Return type:bool
Attribute.is_numeric
Attribute.is_stringy
Attribute.is_temporal
Attribute.is_translated
Attribute.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Attribute.objects = <django.db.models.manager.ManagerFromAttributeQuerySet object>
Attribute.product_types
Attribute.productattribute_set
Attribute.save(*args, **kwargs)[source]
Attribute.translations
Attribute.type

A placeholder class that provides a way to set the attribute on the model.

Attribute.visibility_mode

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.attributes.AttributeQuerySet(*args, **kwargs)[source]

Bases: parler.managers.TranslatableQuerySet

visible()[source]
class shoop.core.models.attributes.AttributeTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.attributes.DoesNotExist, shoop.core.models.attributes.DoesNotExist

exception AttributeTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

AttributeTranslation.get_language_code_display(*moreargs, **morekwargs)
AttributeTranslation.master
AttributeTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.attributes.AttributeType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.attributes.AttributeVisibility[source]

Bases: enumfields.enums.Enum

shoop.core.models.categories module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 26)

autodoc: failed to import attribute ‘CategoryLogEntry.extra’ from module ‘shoop.core.models.categories’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra
class shoop.core.models.categories.Category(id, parent, identifier, status, image, ordering, visibility)[source]

Bases: mptt.models.MPTTModel, parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Category.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Category.children
Category.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.get_status_display(*moreargs, **morekwargs)
Category.get_visibility_display(*moreargs, **morekwargs)
Category.image
Category.is_visible(customer)[source]
Category.log_entries
Category.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.objects = <shoop.core.models.categories.CategoryManager object>
Category.parent
Category.primary_products
Category.primary_shop_products
Category.save(*args, **kwargs)[source]
Category.shop_products
Category.shops
Category.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.status

A placeholder class that provides a way to set the attribute on the model.

Category.translations
Category.visibility

A placeholder class that provides a way to set the attribute on the model.

Category.visibility_groups
class shoop.core.models.categories.CategoryLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shoop.utils.analog.BaseLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception CategoryLogEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

CategoryLogEntry.get_kind_display(*moreargs, **morekwargs)
CategoryLogEntry.get_next_by_created_on(*moreargs, **morekwargs)
CategoryLogEntry.get_previous_by_created_on(*moreargs, **morekwargs)
CategoryLogEntry.kind

A placeholder class that provides a way to set the attribute on the model.

CategoryLogEntry.logged_model

alias of Category

CategoryLogEntry.objects = <django.db.models.manager.Manager object>
CategoryLogEntry.target
CategoryLogEntry.user
class shoop.core.models.categories.CategoryManager[source]

Bases: parler.managers.TranslatableManager, mptt.managers.TreeManager

all_except_deleted(language=None)[source]
all_visible(customer, shop=None, language=None)[source]
class shoop.core.models.categories.CategoryStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.categories.CategoryTranslation(id, language_code, name, description, slug, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.categories.DoesNotExist, shoop.core.models.categories.DoesNotExist

exception CategoryTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

CategoryTranslation.get_language_code_display(*moreargs, **morekwargs)
CategoryTranslation.master
CategoryTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.categories.CategoryVisibility[source]

Bases: enumfields.enums.Enum

shoop.core.models.contacts module
class shoop.core.models.contacts.AnonymousContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, contact_ptr)[source]

Bases: shoop.core.models.contacts.Contact

exception DoesNotExist

Bases: shoop.core.models.contacts.DoesNotExist

exception AnonymousContact.MultipleObjectsReturned

Bases: shoop.core.models.contacts.MultipleObjectsReturned

AnonymousContact.base_objects = <django.db.models.manager.Manager object>
AnonymousContact.contact_ptr
AnonymousContact.delete(*args, **kwargs)[source]
AnonymousContact.groups
AnonymousContact.id = None
AnonymousContact.is_anonymous = True
AnonymousContact.objects = <polymorphic.manager.PolymorphicManager object>
AnonymousContact.pk = None
AnonymousContact.polymorphic_primary_key_name = 'id'
AnonymousContact.polymorphic_super_sub_accessors_replaced = False
AnonymousContact.save(*args, **kwargs)[source]
class shoop.core.models.contacts.CompanyContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, contact_ptr, vat_code)[source]

Bases: shoop.core.models.contacts.Contact

exception DoesNotExist

Bases: shoop.core.models.contacts.DoesNotExist

exception CompanyContact.MultipleObjectsReturned

Bases: shoop.core.models.contacts.MultipleObjectsReturned

CompanyContact.base_objects = <django.db.models.manager.Manager object>
CompanyContact.contact_ptr
CompanyContact.members
CompanyContact.objects = <polymorphic.manager.PolymorphicManager object>
CompanyContact.polymorphic_primary_key_name = 'id'
CompanyContact.polymorphic_super_sub_accessors_replaced = False
class shoop.core.models.contacts.Contact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group)[source]

Bases: shoop.core.utils.name_mixin.NameMixin, polymorphic.polymorphic_model.PolymorphicModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Contact.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Contact.anonymouscontact
Contact.base_objects = <django.db.models.manager.Manager object>
Contact.company_memberships
Contact.companycontact
Contact.customer_orders
Contact.default_billing_address
Contact.default_payment_method
Contact.default_shipping_address
Contact.default_shipping_method
Contact.get_language_display(*moreargs, **morekwargs)
Contact.get_next_by_created_on(*moreargs, **morekwargs)
Contact.get_previous_by_created_on(*moreargs, **morekwargs)
Contact.get_timezone_display(*moreargs, **morekwargs)
Contact.groups
Contact.is_all_seeing = False
Contact.is_anonymous = False
Contact.objects = <polymorphic.manager.PolymorphicManager object>
Contact.personcontact
Contact.polymorphic_ctype
Contact.polymorphic_primary_key_name = 'id'
Contact.polymorphic_super_sub_accessors_replaced = False
Contact.savedaddress_set
Contact.shop_set
Contact.storedbasket_set
Contact.tax_group
Contact.timezone

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.contacts.ContactGroup(id, identifier, show_pricing)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ContactGroup.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ContactGroup.members
ContactGroup.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ContactGroup.objects = <parler.managers.TranslatableManager object>
ContactGroup.simpleproductprice_set
ContactGroup.translations
ContactGroup.visible_categories
ContactGroup.visible_products
class shoop.core.models.contacts.ContactGroupTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.contacts.DoesNotExist, shoop.core.models.contacts.DoesNotExist

exception ContactGroupTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ContactGroupTranslation.get_language_code_display(*moreargs, **morekwargs)
ContactGroupTranslation.master
ContactGroupTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.contacts.Gender[source]

Bases: enumfields.enums.Enum

class shoop.core.models.contacts.PersonContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, contact_ptr, user, gender, birth_date)[source]

Bases: shoop.core.models.contacts.Contact

exception DoesNotExist

Bases: shoop.core.models.contacts.DoesNotExist

exception PersonContact.MultipleObjectsReturned

Bases: shoop.core.models.contacts.MultipleObjectsReturned

PersonContact.base_objects = <django.db.models.manager.Manager object>
PersonContact.contact_ptr
PersonContact.gender

A placeholder class that provides a way to set the attribute on the model.

PersonContact.get_gender_display(*moreargs, **morekwargs)
PersonContact.is_all_seeing
PersonContact.objects = <polymorphic.manager.PolymorphicManager object>
PersonContact.orderer_orders
PersonContact.polymorphic_primary_key_name = 'id'
PersonContact.polymorphic_super_sub_accessors_replaced = False
PersonContact.save(*args, **kwargs)[source]
PersonContact.user
shoop.core.models.contacts.get_person_contact(user)[source]

Get PersonContact of given user.

If given user is non-zero (evaluates true as bool) and not anonymous, return the PersonContact of the user. If there is no PersonContact for the user yet, create it first. When this creation happens, details (name, email, is_active) are copied from the user.

If given user is None (or otherwise evaluates as false) or anonymous, return the AnonymousContact.

Parameters:user (django.contrib.auth.models.User|None) – User object (or None) to get contact for
Returns:PersonContact of the user or AnonymousContact

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/shoop-1.1.0-py3.4.egg/shoop/core/models/contacts.py:docstring of shoop.core.models.contacts.get_person_contact, line 14)

Field list ends without a blank line; unexpected unindent.

:rtype PersonContact|AnonymousContact

shoop.core.models.counters module
class shoop.core.models.counters.Counter(id, value)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Counter.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

classmethod Counter.get_and_increment(id)[source]
Counter.get_id_display(*moreargs, **morekwargs)
Counter.id

A placeholder class that provides a way to set the attribute on the model.

Counter.objects = <django.db.models.manager.Manager object>
shoop.core.models.manufacturers module
class shoop.core.models.manufacturers.Manufacturer(id, created_on, identifier, name, url)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Manufacturer.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Manufacturer.get_next_by_created_on(*moreargs, **morekwargs)
Manufacturer.get_previous_by_created_on(*moreargs, **morekwargs)
Manufacturer.objects = <django.db.models.manager.Manager object>
Manufacturer.product_set
shoop.core.models.methods module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 58)

autodoc: failed to import attribute ‘ShippingMethod.module_data’ from module ‘shoop.core.models.methods’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: module_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 58)

autodoc: failed to import attribute ‘PaymentMethod.module_data’ from module ‘shoop.core.models.methods’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: module_data
class shoop.core.models.methods.MethodType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.methods.ShippingMethod(id, tax_class, status, identifier, module_identifier, module_data)[source]

Bases: shoop.core.models.methods.Method

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShippingMethod.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShippingMethod.contact_set
ShippingMethod.default_module_spec = 'shoop.core.methods.default:DefaultShippingMethodModule'
ShippingMethod.get_status_display(*moreargs, **morekwargs)
ShippingMethod.line_type = <OrderLineType.SHIPPING: 2>
ShippingMethod.module_provides_key = 'shipping_method_module'
ShippingMethod.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ShippingMethod.objects = <django.db.models.manager.ManagerFromMethodQuerySet object>
ShippingMethod.shipping_orders
ShippingMethod.shipping_products
ShippingMethod.shop_product_m2m = 'shipping_methods'
ShippingMethod.status

A placeholder class that provides a way to set the attribute on the model.

ShippingMethod.tax_class
ShippingMethod.translations
ShippingMethod.type = <MethodType.SHIPPING: 1>
class shoop.core.models.methods.PaymentMethod(id, tax_class, status, identifier, module_identifier, module_data)[source]

Bases: shoop.core.models.methods.Method

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PaymentMethod.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PaymentMethod.contact_set
PaymentMethod.default_module_spec = 'shoop.core.methods.default:DefaultPaymentMethodModule'
PaymentMethod.get_payment_process_response(order, urls)[source]
PaymentMethod.get_status_display(*moreargs, **morekwargs)
PaymentMethod.line_type = <OrderLineType.PAYMENT: 3>
PaymentMethod.module_provides_key = 'payment_method_module'
PaymentMethod.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

PaymentMethod.objects = <django.db.models.manager.ManagerFromMethodQuerySet object>
PaymentMethod.payment_orders
PaymentMethod.payment_products
PaymentMethod.process_payment_return_request(order, request)[source]
PaymentMethod.shop_product_m2m = 'payment_methods'
PaymentMethod.status

A placeholder class that provides a way to set the attribute on the model.

PaymentMethod.tax_class
PaymentMethod.translations
PaymentMethod.type = <MethodType.PAYMENT: 2>
class shoop.core.models.methods.MethodStatus[source]

Bases: enumfields.enums.Enum

shoop.core.models.order_lines module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 66)

autodoc: failed to import attribute ‘OrderLine.extra_data’ from module ‘shoop.core.models.order_lines’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra_data
class shoop.core.models.order_lines.OrderLine(id, order, product, supplier, parent_line, ordering, type, sku, text, accounting_identifier, require_verification, verified, extra_data, quantity, _unit_price_amount, _total_discount_amount, _prices_include_tax)[source]

Bases: django.db.models.base.Model, shoop.core.utils.prices.LinePriceMixin

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLine.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLine.child_lines
OrderLine.get_type_display(*moreargs, **morekwargs)
OrderLine.objects = <shoop.core.models.order_lines.OrderLineManager object>
OrderLine.order
OrderLine.parent_line
OrderLine.product
OrderLine.save(*args, **kwargs)[source]
OrderLine.supplier
OrderLine.taxes
OrderLine.total_discount

Total discount of OrderLine.

Return type:Price
OrderLine.total_tax_amount
Return type:decimal.Decimal
OrderLine.type

A placeholder class that provides a way to set the attribute on the model.

OrderLine.unit_price

Unit price of OrderLine.

Return type:Price
class shoop.core.models.order_lines.OrderLineManager[source]

Bases: django.db.models.manager.Manager

campaigns()[source]
other()[source]
payment()[source]
products()[source]
shipping()[source]
class shoop.core.models.order_lines.OrderLineTax(id, order_line, tax, name, amount, base_amount, ordering)[source]

Bases: shoop.core.models._base.ShoopModel, shoop.core.taxing._line_tax.LineTax

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLineTax.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLineTax.objects = <django.db.models.manager.Manager object>
OrderLineTax.order_line
OrderLineTax.tax
class shoop.core.models.order_lines.OrderLineType[source]

Bases: enumfields.enums.Enum

shoop.core.models.orders module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 74)

autodoc: failed to import attribute ‘Order.extra_data’ from module ‘shoop.core.models.orders’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 74)

autodoc: failed to import attribute ‘Order.payment_data’ from module ‘shoop.core.models.orders’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: payment_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 74)

autodoc: failed to import attribute ‘Order.shipping_data’ from module ‘shoop.core.models.orders’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: shipping_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 74)

autodoc: failed to import attribute ‘OrderLogEntry.extra’ from module ‘shoop.core.models.orders’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra
class shoop.core.models.orders.Order(id, shop, created_on, identifier, label, key, reference_number, customer, orderer, billing_address, shipping_address, vat_code, phone, email, creator, deleted, status, payment_status, shipping_status, payment_method, payment_method_name, payment_data, shipping_method, shipping_method_name, shipping_data, extra_data, taxful_total_price, taxless_total_price, display_currency, display_currency_rate, ip_address, order_date, payment_date, language, customer_comment, admin_comment, require_verification, all_verified, marketing_permission)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Order.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Order.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Order.billing_address
Order.cache_prices()[source]
Order.can_set_complete()[source]
Order.check_all_verified()[source]
Order.check_and_set_fully_shipped()[source]
Order.create_immutable_address_copies()[source]
Order.create_payment(amount, payment_identifier=None, description='')[source]

Create a payment with given amount for this order.

If the order already has payments and sum of their amounts is equal or greater than self.taxful_total_price, an exception is raised.

If the end sum of all payments is equal or greater than self.taxful_total_price, then the order is marked as paid.

Parameters:
  • amount – amount of the payment to be created
  • gateway_id – identifier of the gateway used to make this payment. Leave empty for non-gateway payments.
  • payment_identifier – Identifier of the created payment. If not set, default value of “gateway_id:order_id:number” will be used (where number is number of payments in the order).
  • description – Description of the payment. Will be set to method property of the created payment.

Returns the created Payment object.

Order.create_shipment(supplier, product_quantities)[source]

Create a shipment for this order from product_quantities. product_quantities is expected to be a dict mapping Product instances to quantities.

Only quantities over 0 are taken into account, and if the mapping is empty or has no quantity value over 0, NoProductsToShipException will be raised.

Parameters:
  • supplier – The Supplier for this product. No validation is made as to whether the given supplier supplies the products.
  • product_quantities (dict[shoop.shop.models.products.Product, decimal.Decimal]) – a dict mapping Product instances to quantities to ship
Raises:

NoProductsToShipException

Returns:

Saved, complete Shipment object

Return type:

shoop.core.models.shipments.Shipment

Order.create_shipment_of_all_products(supplier=None)[source]

Create a shipment of all the products in this Order, no matter whether or not any have been previously marked as shipped or not.

See the documentation for create_shipment.

Parameters:supplier – The Supplier to use. If None, the first supplier in the order is used. (If several are in the order, this fails.)
Returns:Saved, complete Shipment object
Return type:shoop.shop.models.shipments.Shipment
Order.creator
Order.customer
Order.delete(using=None)[source]
Order.full_clean(exclude=None, validate_unique=True)[source]
Order.get_known_additional_data()[source]

Get a list of “known additional data” in this order’s payment_data, shipping_data and extra_data. The list is returned in the order the fields are specified in the settings entries for said known keys. dict(that_list) can of course be used to “flatten” the list into a dict. :return: list of 2-tuples.

Order.get_language_display(*moreargs, **morekwargs)
Order.get_next_by_created_on(*moreargs, **morekwargs)
Order.get_next_by_order_date(*moreargs, **morekwargs)
Order.get_payment_status_display(*moreargs, **morekwargs)
Order.get_previous_by_created_on(*moreargs, **morekwargs)
Order.get_previous_by_order_date(*moreargs, **morekwargs)
Order.get_product_ids_and_quantities()[source]
Order.get_product_summary()[source]

Return a dict of product IDs -> {ordered, unshipped, shipped}

Order.get_purchased_attachments()[source]
Order.get_shipping_status_display(*moreargs, **morekwargs)
Order.get_status_display()[source]
Order.get_tax_summary()[source]
Return type:taxing.TaxSummary
Order.get_total_paid_amount()[source]
Order.get_unshipped_products()[source]
Order.is_complete()[source]
Order.is_paid()[source]
Order.lines
Order.log_entries
Order.objects = <django.db.models.manager.ManagerFromOrderQuerySet object>
Order.orderer
Order.payment_method
Order.payment_status

A placeholder class that provides a way to set the attribute on the model.

Order.payments
Order.save(*args, **kwargs)[source]
Order.set_canceled()[source]
Order.shipments
Order.shipping_address
Order.shipping_method
Order.shipping_status

A placeholder class that provides a way to set the attribute on the model.

Order.shop
Order.status
class shoop.core.models.orders.OrderLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shoop.utils.analog.BaseLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLogEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLogEntry.get_kind_display(*moreargs, **morekwargs)
OrderLogEntry.get_next_by_created_on(*moreargs, **morekwargs)
OrderLogEntry.get_previous_by_created_on(*moreargs, **morekwargs)
OrderLogEntry.kind

A placeholder class that provides a way to set the attribute on the model.

OrderLogEntry.logged_model

alias of Order

OrderLogEntry.objects = <django.db.models.manager.Manager object>
OrderLogEntry.target
OrderLogEntry.user
class shoop.core.models.orders.OrderQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: django.db.models.query.QuerySet

complete()[source]
incomplete()[source]
paid()[source]
since(days)[source]
valid()[source]
class shoop.core.models.orders.OrderStatus(id, identifier, ordering, role, default)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderStatus.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderStatus.get_role_display(*moreargs, **morekwargs)
OrderStatus.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

OrderStatus.objects = <django.db.models.manager.ManagerFromOrderStatusQuerySet object>
OrderStatus.order_set
OrderStatus.role

A placeholder class that provides a way to set the attribute on the model.

OrderStatus.save(*args, **kwargs)[source]
OrderStatus.translations
class shoop.core.models.orders.OrderStatusQuerySet(*args, **kwargs)[source]

Bases: parler.managers.TranslatableQuerySet

get_default_canceled()[source]
get_default_complete()[source]
get_default_initial()[source]
class shoop.core.models.orders.OrderStatusRole[source]

Bases: enumfields.enums.Enum

class shoop.core.models.orders.OrderStatusTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.orders.DoesNotExist, shoop.core.models.orders.DoesNotExist

exception OrderStatusTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderStatusTranslation.get_language_code_display(*moreargs, **morekwargs)
OrderStatusTranslation.master
OrderStatusTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.orders.PaymentStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.orders.ShippingStatus[source]

Bases: enumfields.enums.Enum

shoop.core.models.payments module
class shoop.core.models.payments.Payment(id, order, created_on, gateway_id, payment_identifier, amount, description)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Payment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Payment.get_next_by_created_on(*moreargs, **morekwargs)
Payment.get_previous_by_created_on(*moreargs, **morekwargs)
Payment.objects = <django.db.models.manager.Manager object>
Payment.order
shoop.core.models.persistent_cache module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 90)

autodoc: failed to import attribute ‘PersistentCacheEntry.data’ from module ‘shoop.core.models.persistent_cache’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: data
class shoop.core.models.persistent_cache.PersistentCacheEntry(id, module, key, time, data)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PersistentCacheEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PersistentCacheEntry.get_next_by_time(*moreargs, **morekwargs)
PersistentCacheEntry.get_previous_by_time(*moreargs, **morekwargs)
PersistentCacheEntry.objects = <django.db.models.manager.Manager object>
shoop.core.models.product_media module
class shoop.core.models.product_media.ProductMedia(id, identifier, product, kind, file, external_url, ordering, enabled, public, purchased)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductMedia.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductMedia.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductMedia.easy_thumbnails_thumbnailer
ProductMedia.effective_title
ProductMedia.file
ProductMedia.get_kind_display(*moreargs, **morekwargs)
ProductMedia.kind

A placeholder class that provides a way to set the attribute on the model.

ProductMedia.objects = <parler.managers.TranslatableManager object>
ProductMedia.primary_image_for_products
ProductMedia.primary_image_for_shop_products
ProductMedia.product
ProductMedia.shops
ProductMedia.title

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductMedia.translations
ProductMedia.url
class shoop.core.models.product_media.ProductMediaKind[source]

Bases: enumfields.enums.Enum

class shoop.core.models.product_media.ProductMediaTranslation(id, language_code, title, description, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.product_media.DoesNotExist, shoop.core.models.product_media.DoesNotExist

exception ProductMediaTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductMediaTranslation.get_language_code_display(*moreargs, **morekwargs)
ProductMediaTranslation.master
ProductMediaTranslation.objects = <django.db.models.manager.Manager object>
shoop.core.models.product_packages module

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductPackageLink.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductPackageLink.child
ProductPackageLink.objects = <django.db.models.manager.Manager object>
ProductPackageLink.parent
shoop.core.models.product_shops module
class shoop.core.models.product_shops.ShopProduct(id, shop, product, visible, listed, purchasable, searchable, visibility_limit, purchase_multiple, minimum_purchase_quantity, limit_shipping_methods, limit_payment_methods, primary_category, shop_primary_image)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShopProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShopProduct.categories
ShopProduct.get_orderability_errors(supplier, quantity, customer, ignore_minimum=False)[source]

Yield ValidationErrors that would cause this product to not be orderable.

Parameters:
Returns:

Iterable[ValidationError]

ShopProduct.get_visibility_errors(customer)[source]
ShopProduct.get_visibility_limit_display(*moreargs, **morekwargs)
ShopProduct.images
ShopProduct.is_list_visible()[source]

Return True if this product should be visible in listings in general, without taking into account any other visibility limitations. :rtype: bool

ShopProduct.is_orderable(supplier, customer, quantity)[source]
ShopProduct.objects = <django.db.models.manager.Manager object>
ShopProduct.payment_methods
ShopProduct.primary_category
ShopProduct.primary_image
ShopProduct.product
ShopProduct.quantity_step

Quantity step for purchasing this product.

Return type:decimal.Decimal
Example:
<input type=”number” step=”{{ shop_product.quantity_step }}”>
ShopProduct.raise_if_not_orderable(supplier, customer, quantity, ignore_minimum=False)[source]
ShopProduct.raise_if_not_visible(customer)[source]
ShopProduct.rounded_minimum_purchase_quantity

The minimum purchase quantity, rounded to the sales unit’s precision.

Return type:decimal.Decimal
Example:
<input type=”number”
min=”{{ shop_product.rounded_minimum_purchase_quantity }}” value=”{{ shop_product.rounded_minimum_purchase_quantity }}”>
ShopProduct.shipping_methods
ShopProduct.shop
ShopProduct.shop_primary_image
ShopProduct.suppliers
ShopProduct.visibility_groups
ShopProduct.visibility_limit

A placeholder class that provides a way to set the attribute on the model.

shoop.core.models.product_variation module
class shoop.core.models.product_variation.ProductVariationVariable(id, product, identifier)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationVariable.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationVariable.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductVariationVariable.objects = <parler.managers.TranslatableManager object>
ProductVariationVariable.product
ProductVariationVariable.translations
ProductVariationVariable.values
class shoop.core.models.product_variation.ProductVariationVariableValue(id, variable, identifier)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationVariableValue.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationVariableValue.objects = <parler.managers.TranslatableManager object>
ProductVariationVariableValue.translations
ProductVariationVariableValue.value

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductVariationVariableValue.variable
class shoop.core.models.product_variation.ProductVariationResult(id, product, combination_hash, result, status)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationResult.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationResult.get_status_display(*moreargs, **morekwargs)
ProductVariationResult.objects = <django.db.models.manager.Manager object>
ProductVariationResult.product
classmethod ProductVariationResult.resolve(parent_product, combination)[source]
ProductVariationResult.result
ProductVariationResult.status

A placeholder class that provides a way to set the attribute on the model.

shoop.core.models.products module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 130)

autodoc: failed to import attribute ‘ProductLogEntry.extra’ from module ‘shoop.core.models.products’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra
class shoop.core.models.products.Product(id, created_on, modified_on, deleted, mode, variation_parent, stock_behavior, shipping_mode, sales_unit, tax_class, type, sku, gtin, barcode, accounting_identifier, profit_center, cost_center, category, width, height, depth, net_weight, gross_weight, purchase_price, suggested_retail_price, manufacturer, primary_image)[source]

Bases: shoop.core.models.attributes.AttributableMixin, parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Product.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Product.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Product.attributes
Product.category
Product.cross_sell_1
Product.cross_sell_2
Product.delete(using=None)[source]
Product.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.get_available_attribute_queryset()[source]
Product.get_base_price()[source]
Product.get_cheapest_child_price(context, quantity=1)[source]
Product.get_mode_display(*moreargs, **morekwargs)
Product.get_next_by_created_on(*moreargs, **morekwargs)
Product.get_next_by_modified_on(*moreargs, **morekwargs)
Product.get_package_child_to_quantity_map()[source]
Product.get_previous_by_created_on(*moreargs, **morekwargs)
Product.get_previous_by_modified_on(*moreargs, **morekwargs)
Product.get_price(context, quantity=1)[source]
Return type:shoop.core.pricing.Price
Product.get_shipping_mode_display(*moreargs, **morekwargs)
Product.get_shop_instance(shop)[source]
Return type:shoop.core.models.product_shops.ShopProduct
Product.get_stock_behavior_display(*moreargs, **morekwargs)
Product.get_taxed_price(context, quantity=1)[source]
Return type:shoop.core.pricing.TaxedPrice
Product.keywords

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.log_entries
Product.make_package(package_def)[source]
Product.manufacturer
Product.media
Product.mode

A placeholder class that provides a way to set the attribute on the model.

Product.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.objects = <django.db.models.manager.ManagerFromProductQuerySet object>
Product.order_lines
Product.primary_image
Product.sales_unit
Product.save(*args, **kwargs)[source]
Product.shipments
Product.shipping_mode

A placeholder class that provides a way to set the attribute on the model.

Product.shop_products
Product.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.soft_delete(user=None)[source]
Product.status_text

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.stock_behavior

A placeholder class that provides a way to set the attribute on the model.

Product.storedbasket_set
Product.suppliedproduct_set
Product.tax_class
Product.translations
Product.type
Product.variation_children
Product.variation_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.variation_parent
Product.variation_result_subs
Product.variation_result_supers
Product.variation_variables
Product.verify_mode()[source]
class shoop.core.models.products.ProductAttribute(id, attribute, numeric_value, datetime_value, untranslated_string_value, product)[source]

Bases: shoop.core.models.attributes.AppliedAttribute

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductAttribute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductAttribute.attribute
ProductAttribute.objects = <parler.managers.TranslatableManager object>
ProductAttribute.product
ProductAttribute.translated_string_value

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductAttribute.translations
class shoop.core.models.products.ProductAttributeTranslation(id, language_code, translated_string_value, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.products.DoesNotExist, shoop.core.models.products.DoesNotExist

exception ProductAttributeTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductAttributeTranslation.get_language_code_display(*moreargs, **morekwargs)
ProductAttributeTranslation.master
ProductAttributeTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.products.ProductCrossSell(id, product1, product2, weight, type)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductCrossSell.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductCrossSell.get_type_display(*moreargs, **morekwargs)
ProductCrossSell.objects = <django.db.models.manager.Manager object>
ProductCrossSell.product1
ProductCrossSell.product2
ProductCrossSell.type

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.products.ProductCrossSellType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.products.ProductLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shoop.utils.analog.BaseLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductLogEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductLogEntry.get_kind_display(*moreargs, **morekwargs)
ProductLogEntry.get_next_by_created_on(*moreargs, **morekwargs)
ProductLogEntry.get_previous_by_created_on(*moreargs, **morekwargs)
ProductLogEntry.kind

A placeholder class that provides a way to set the attribute on the model.

ProductLogEntry.logged_model

alias of Product

ProductLogEntry.objects = <django.db.models.manager.Manager object>
ProductLogEntry.target
ProductLogEntry.user
class shoop.core.models.products.ProductMode[source]

Bases: enumfields.enums.Enum

class shoop.core.models.products.ProductQuerySet(*args, **kwargs)[source]

Bases: parler.managers.TranslatableQuerySet

all_except_deleted(language=None)[source]
list_visible(shop, customer, language=None)[source]
class shoop.core.models.products.ProductTranslation(id, language_code, name, description, slug, keywords, status_text, variation_name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.products.DoesNotExist, shoop.core.models.products.DoesNotExist

exception ProductTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductTranslation.get_language_code_display(*moreargs, **morekwargs)
ProductTranslation.master
ProductTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.products.ProductType(id, identifier)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductType.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductType.attributes
ProductType.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductType.objects = <parler.managers.TranslatableManager object>
ProductType.products
ProductType.translations
class shoop.core.models.products.ProductTypeTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.products.DoesNotExist, shoop.core.models.products.DoesNotExist

exception ProductTypeTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductTypeTranslation.get_language_code_display(*moreargs, **morekwargs)
ProductTypeTranslation.master
ProductTypeTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.products.ProductVerificationMode[source]

Bases: enumfields.enums.Enum

class shoop.core.models.products.ProductVisibility[source]

Bases: enumfields.enums.Enum

class shoop.core.models.products.ShippingMode[source]

Bases: enumfields.enums.Enum

class shoop.core.models.products.StockBehavior[source]

Bases: enumfields.enums.Enum

shoop.core.models.shipments module
class shoop.core.models.shipments.Shipment(id, order, supplier, created_on, status, tracking_code, description, volume, weight)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Shipment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Shipment.cache_values()[source]

(Re)cache .volume and .weight for this Shipment from the ShipmentProducts within.

Shipment.get_next_by_created_on(*moreargs, **morekwargs)
Shipment.get_previous_by_created_on(*moreargs, **morekwargs)
Shipment.get_status_display(*moreargs, **morekwargs)
Shipment.objects = <django.db.models.manager.Manager object>
Shipment.order
Shipment.products
Shipment.status

A placeholder class that provides a way to set the attribute on the model.

Shipment.supplier
Shipment.total_products
class shoop.core.models.shipments.ShipmentProduct(id, shipment, product, quantity, unit_volume, unit_weight)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShipmentProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShipmentProduct.cache_values()[source]
ShipmentProduct.objects = <django.db.models.manager.Manager object>
ShipmentProduct.product
ShipmentProduct.shipment
shoop.core.models.shops module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 146)

autodoc: failed to import attribute ‘Shop.options’ from module ‘shoop.core.models.shops’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: options
class shoop.core.models.shops.Shop(id, identifier, domain, status, owner, options)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Shop.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Shop.categories
Shop.get_status_display(*moreargs, **morekwargs)
Shop.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Shop.objects = <parler.managers.TranslatableManager object>
Shop.order_set
Shop.owner
Shop.product_media
Shop.shop_products
Shop.simpleproductprice_set
Shop.status

A placeholder class that provides a way to set the attribute on the model.

Shop.translations
class shoop.core.models.shops.ShopStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.shops.ShopTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.shops.DoesNotExist, shoop.core.models.shops.DoesNotExist

exception ShopTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShopTranslation.get_language_code_display(*moreargs, **morekwargs)
ShopTranslation.master
ShopTranslation.objects = <django.db.models.manager.Manager object>
shoop.core.models.supplied_products module
class shoop.core.models.supplied_products.SuppliedProduct(id, supplier, product, sku, alert_limit, purchase_price, suggested_retail_price, physical_count, logical_count)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SuppliedProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SuppliedProduct.objects = <django.db.models.manager.Manager object>
SuppliedProduct.product
SuppliedProduct.supplier
shoop.core.models.suppliers module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 162)

autodoc: failed to import attribute ‘Supplier.module_data’ from module ‘shoop.core.models.suppliers’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: module_data
class shoop.core.models.suppliers.Supplier(id, identifier, name, type, stock_managed, module_identifier, module_data)[source]

Bases: shoop.core.modules.interface.ModuleInterface, django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Supplier.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Supplier.adjust_stock(product_id, delta, created_by=None)[source]
Supplier.default_module_spec = 'shoop.core.suppliers:BaseSupplierModule'
Supplier.get_orderability_errors(shop_product, quantity, customer)[source]
Parameters:
Return type:

iterable[ValidationError]

Supplier.get_stock_status(product_id)[source]
Parameters:product_id (int) – Product ID
Return type:shoop.core.stocks.ProductStockStatus
Supplier.get_stock_statuses(product_ids)[source]
Parameters:product_ids – Iterable of product IDs
Returns:Dict of {product_id: ProductStockStatus}
Return type:dict[int, shoop.core.stocks.ProductStockStatus]
Supplier.get_type_display(*moreargs, **morekwargs)
Supplier.module_provides_key = 'supplier_module'
Supplier.objects = <django.db.models.manager.Manager object>
Supplier.order_lines
Supplier.shipments
Supplier.shop_products
Supplier.stockadjustment_set
Supplier.stockcount_set
Supplier.suppliedproduct_set
Supplier.type

A placeholder class that provides a way to set the attribute on the model.

Supplier.update_stock(product_id)[source]
Supplier.update_stocks(product_ids)[source]
class shoop.core.models.suppliers.SupplierType[source]

Bases: enumfields.enums.Enum

shoop.core.models.taxes module
class shoop.core.models.taxes.CustomerTaxGroup(id, identifier, enabled)[source]

Bases: shoop.core.models._base.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception CustomerTaxGroup.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

CustomerTaxGroup.contact_set
CustomerTaxGroup.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

CustomerTaxGroup.objects = <parler.managers.TranslatableManager object>
CustomerTaxGroup.taxrule_set
CustomerTaxGroup.translations
class shoop.core.models.taxes.CustomerTaxGroupTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.taxes.DoesNotExist, shoop.core.models.taxes.DoesNotExist

exception CustomerTaxGroupTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

CustomerTaxGroupTranslation.get_language_code_display(*moreargs, **morekwargs)
CustomerTaxGroupTranslation.master
CustomerTaxGroupTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.taxes.Tax(id, code, rate, amount, enabled)[source]

Bases: shoop.core.models._base.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Tax.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Tax.calculate_amount(base_amount)[source]
Tax.clean()[source]
Tax.identifier_attr = 'code'
Tax.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Tax.objects = <parler.managers.TranslatableManager object>
Tax.order_line_taxes
Tax.save(*args, **kwargs)[source]
Tax.taxrule_set
Tax.translations
class shoop.core.models.taxes.TaxClass(id, identifier, enabled)[source]

Bases: shoop.core.models._base.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception TaxClass.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

TaxClass.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

TaxClass.objects = <parler.managers.TranslatableManager object>
TaxClass.paymentmethod_set
TaxClass.product_set
TaxClass.shippingmethod_set
TaxClass.taxrule_set
TaxClass.translations
class shoop.core.models.taxes.TaxClassTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.taxes.DoesNotExist, shoop.core.models.taxes.DoesNotExist

exception TaxClassTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

TaxClassTranslation.get_language_code_display(*moreargs, **morekwargs)
TaxClassTranslation.master
TaxClassTranslation.objects = <django.db.models.manager.Manager object>
class shoop.core.models.taxes.TaxTranslation(id, language_code, name, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.core.models.taxes.DoesNotExist, shoop.core.models.taxes.DoesNotExist

exception TaxTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

TaxTranslation.get_language_code_display(*moreargs, **morekwargs)
TaxTranslation.master
TaxTranslation.objects = <django.db.models.manager.Manager object>
shoop.core.models.units module
class shoop.core.models.units.SalesUnit(id, identifier, decimals)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SalesUnit.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SalesUnit.allow_fractions
SalesUnit.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

SalesUnit.objects = <parler.managers.TranslatableManager object>
SalesUnit.product_set
SalesUnit.quantity_step

Get the quantity increment for the amount of decimals this unit allows.

For 0 decimals, this will be 1; for 1 decimal, 0.1; etc.

Returns:Decimal in (0..1]
Return type:Decimal
SalesUnit.round(value)[source]
SalesUnit.short_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

SalesUnit.translations
Module contents

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘Address.country’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/django_countries-3.3-py3.4.egg/django_countries/fields.py”, line 111, in __get__ % (self.field.name, owner.__name__)) AttributeError: The ‘country’ attribute can only be accessed from Address instances. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: country

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘Order.extra_data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘Order.payment_data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: payment_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘Order.shipping_data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: shipping_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘OrderLine.extra_data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘OrderLogEntry.extra’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘PaymentMethod.module_data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: module_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘PersistentCacheEntry.data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘ShippingMethod.module_data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: module_data

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘Shop.options’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: options

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.core.models.rst, line 187)

autodoc: failed to import attribute ‘Supplier.module_data’ from module ‘shoop.core.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: module_data
class shoop.core.models.Address(id, prefix, name, suffix, name_ext, company_name, vat_code, phone, email, street, street2, street3, postal_code, city, region_code, region, country, is_immutable)[source]

Bases: shoop.core.utils.name_mixin.NameMixin, django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Address.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Address.as_string_list(locale=None)[source]
Address.billing_orders
Address.copy()[source]
Address.get_country_display(*moreargs, **morekwargs)
Address.is_european_union
Address.is_home
Address.objects = <shoop.core.models.addresses.AddressManager object>
Address.save(*args, **kwargs)[source]
Address.saved_addresses
Address.set_immutable()[source]
Address.shipping_orders
class shoop.core.models.AnonymousContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, contact_ptr)[source]

Bases: shoop.core.models.contacts.Contact

exception DoesNotExist

Bases: shoop.core.models.contacts.DoesNotExist

exception AnonymousContact.MultipleObjectsReturned

Bases: shoop.core.models.contacts.MultipleObjectsReturned

AnonymousContact.base_objects = <django.db.models.manager.Manager object>
AnonymousContact.contact_ptr
AnonymousContact.delete(*args, **kwargs)[source]
AnonymousContact.groups
AnonymousContact.id = None
AnonymousContact.is_anonymous = True
AnonymousContact.objects = <polymorphic.manager.PolymorphicManager object>
AnonymousContact.pk = None
AnonymousContact.polymorphic_primary_key_name = 'id'
AnonymousContact.polymorphic_super_sub_accessors_replaced = False
AnonymousContact.save(*args, **kwargs)[source]
class shoop.core.models.Attribute(id, identifier, searchable, type, visibility_mode)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Attribute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Attribute.formfield(**kwargs)[source]

Get a form field for this attribute.

Parameters:kwargs – Kwargs to pass for the form field class.
Returns:Form field.
Return type:forms.Field
Attribute.get_type_display(*moreargs, **morekwargs)
Attribute.get_visibility_mode_display(*moreargs, **morekwargs)
Attribute.is_null_value(value)[source]

Find out whether the given value is null from this attribute’s point of view.

Parameters:value (object) – A value
Returns:Nulliness boolean
Return type:bool
Attribute.is_numeric
Attribute.is_stringy
Attribute.is_temporal
Attribute.is_translated
Attribute.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Attribute.objects = <django.db.models.manager.ManagerFromAttributeQuerySet object>
Attribute.product_types
Attribute.productattribute_set
Attribute.save(*args, **kwargs)[source]
Attribute.translations
Attribute.type

A placeholder class that provides a way to set the attribute on the model.

Attribute.visibility_mode

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.AttributeType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.AttributeVisibility[source]

Bases: enumfields.enums.Enum

class shoop.core.models.Category(id, parent, identifier, status, image, ordering, visibility)[source]

Bases: mptt.models.MPTTModel, parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Category.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Category.children
Category.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.get_status_display(*moreargs, **morekwargs)
Category.get_visibility_display(*moreargs, **morekwargs)
Category.image
Category.is_visible(customer)[source]
Category.log_entries
Category.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.objects = <shoop.core.models.categories.CategoryManager object>
Category.parent
Category.primary_products
Category.primary_shop_products
Category.save(*args, **kwargs)[source]
Category.shop_products
Category.shops
Category.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Category.status

A placeholder class that provides a way to set the attribute on the model.

Category.translations
Category.visibility

A placeholder class that provides a way to set the attribute on the model.

Category.visibility_groups
class shoop.core.models.CategoryStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.CategoryVisibility[source]

Bases: enumfields.enums.Enum

class shoop.core.models.CompanyContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, contact_ptr, vat_code)[source]

Bases: shoop.core.models.contacts.Contact

exception DoesNotExist

Bases: shoop.core.models.contacts.DoesNotExist

exception CompanyContact.MultipleObjectsReturned

Bases: shoop.core.models.contacts.MultipleObjectsReturned

CompanyContact.base_objects = <django.db.models.manager.Manager object>
CompanyContact.contact_ptr
CompanyContact.members
CompanyContact.objects = <polymorphic.manager.PolymorphicManager object>
CompanyContact.polymorphic_primary_key_name = 'id'
CompanyContact.polymorphic_super_sub_accessors_replaced = False
class shoop.core.models.Contact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group)[source]

Bases: shoop.core.utils.name_mixin.NameMixin, polymorphic.polymorphic_model.PolymorphicModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Contact.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Contact.anonymouscontact
Contact.base_objects = <django.db.models.manager.Manager object>
Contact.company_memberships
Contact.companycontact
Contact.customer_orders
Contact.default_billing_address
Contact.default_payment_method
Contact.default_shipping_address
Contact.default_shipping_method
Contact.get_language_display(*moreargs, **morekwargs)
Contact.get_next_by_created_on(*moreargs, **morekwargs)
Contact.get_previous_by_created_on(*moreargs, **morekwargs)
Contact.get_timezone_display(*moreargs, **morekwargs)
Contact.groups
Contact.is_all_seeing = False
Contact.is_anonymous = False
Contact.objects = <polymorphic.manager.PolymorphicManager object>
Contact.personcontact
Contact.polymorphic_ctype
Contact.polymorphic_primary_key_name = 'id'
Contact.polymorphic_super_sub_accessors_replaced = False
Contact.savedaddress_set
Contact.shop_set
Contact.storedbasket_set
Contact.tax_group
Contact.timezone

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ContactGroup(id, identifier, show_pricing)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ContactGroup.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ContactGroup.members
ContactGroup.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ContactGroup.objects = <parler.managers.TranslatableManager object>
ContactGroup.simpleproductprice_set
ContactGroup.translations
ContactGroup.visible_categories
ContactGroup.visible_products
class shoop.core.models.Counter(id, value)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Counter.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

classmethod Counter.get_and_increment(id)[source]
Counter.get_id_display(*moreargs, **morekwargs)
Counter.id

A placeholder class that provides a way to set the attribute on the model.

Counter.objects = <django.db.models.manager.Manager object>
class shoop.core.models.CounterType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.CustomerTaxGroup(id, identifier, enabled)[source]

Bases: shoop.core.models._base.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception CustomerTaxGroup.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

CustomerTaxGroup.contact_set
CustomerTaxGroup.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

CustomerTaxGroup.objects = <parler.managers.TranslatableManager object>
CustomerTaxGroup.taxrule_set
CustomerTaxGroup.translations
shoop.core.models.get_person_contact(user)[source]

Get PersonContact of given user.

If given user is non-zero (evaluates true as bool) and not anonymous, return the PersonContact of the user. If there is no PersonContact for the user yet, create it first. When this creation happens, details (name, email, is_active) are copied from the user.

If given user is None (or otherwise evaluates as false) or anonymous, return the AnonymousContact.

Parameters:user (django.contrib.auth.models.User|None) – User object (or None) to get contact for
Returns:PersonContact of the user or AnonymousContact

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/shoop-1.1.0-py3.4.egg/shoop/core/models/__init__.py:docstring of shoop.core.models.get_person_contact, line 14)

Field list ends without a blank line; unexpected unindent.

:rtype PersonContact|AnonymousContact

class shoop.core.models.Gender[source]

Bases: enumfields.enums.Enum

class shoop.core.models.Manufacturer(id, created_on, identifier, name, url)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Manufacturer.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Manufacturer.get_next_by_created_on(*moreargs, **morekwargs)
Manufacturer.get_previous_by_created_on(*moreargs, **morekwargs)
Manufacturer.objects = <django.db.models.manager.Manager object>
Manufacturer.product_set
class shoop.core.models.MethodStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.MethodType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.Order(id, shop, created_on, identifier, label, key, reference_number, customer, orderer, billing_address, shipping_address, vat_code, phone, email, creator, deleted, status, payment_status, shipping_status, payment_method, payment_method_name, payment_data, shipping_method, shipping_method_name, shipping_data, extra_data, taxful_total_price, taxless_total_price, display_currency, display_currency_rate, ip_address, order_date, payment_date, language, customer_comment, admin_comment, require_verification, all_verified, marketing_permission)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Order.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Order.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Order.billing_address
Order.cache_prices()[source]
Order.can_set_complete()[source]
Order.check_all_verified()[source]
Order.check_and_set_fully_shipped()[source]
Order.create_immutable_address_copies()[source]
Order.create_payment(amount, payment_identifier=None, description='')[source]

Create a payment with given amount for this order.

If the order already has payments and sum of their amounts is equal or greater than self.taxful_total_price, an exception is raised.

If the end sum of all payments is equal or greater than self.taxful_total_price, then the order is marked as paid.

Parameters:
  • amount – amount of the payment to be created
  • gateway_id – identifier of the gateway used to make this payment. Leave empty for non-gateway payments.
  • payment_identifier – Identifier of the created payment. If not set, default value of “gateway_id:order_id:number” will be used (where number is number of payments in the order).
  • description – Description of the payment. Will be set to method property of the created payment.

Returns the created Payment object.

Order.create_shipment(supplier, product_quantities)[source]

Create a shipment for this order from product_quantities. product_quantities is expected to be a dict mapping Product instances to quantities.

Only quantities over 0 are taken into account, and if the mapping is empty or has no quantity value over 0, NoProductsToShipException will be raised.

Parameters:
  • supplier – The Supplier for this product. No validation is made as to whether the given supplier supplies the products.
  • product_quantities (dict[shoop.shop.models.products.Product, decimal.Decimal]) – a dict mapping Product instances to quantities to ship
Raises:

NoProductsToShipException

Returns:

Saved, complete Shipment object

Return type:

shoop.core.models.shipments.Shipment

Order.create_shipment_of_all_products(supplier=None)[source]

Create a shipment of all the products in this Order, no matter whether or not any have been previously marked as shipped or not.

See the documentation for create_shipment.

Parameters:supplier – The Supplier to use. If None, the first supplier in the order is used. (If several are in the order, this fails.)
Returns:Saved, complete Shipment object
Return type:shoop.shop.models.shipments.Shipment
Order.creator
Order.customer
Order.delete(using=None)[source]
Order.full_clean(exclude=None, validate_unique=True)[source]
Order.get_known_additional_data()[source]

Get a list of “known additional data” in this order’s payment_data, shipping_data and extra_data. The list is returned in the order the fields are specified in the settings entries for said known keys. dict(that_list) can of course be used to “flatten” the list into a dict. :return: list of 2-tuples.

Order.get_language_display(*moreargs, **morekwargs)
Order.get_next_by_created_on(*moreargs, **morekwargs)
Order.get_next_by_order_date(*moreargs, **morekwargs)
Order.get_payment_status_display(*moreargs, **morekwargs)
Order.get_previous_by_created_on(*moreargs, **morekwargs)
Order.get_previous_by_order_date(*moreargs, **morekwargs)
Order.get_product_ids_and_quantities()[source]
Order.get_product_summary()[source]

Return a dict of product IDs -> {ordered, unshipped, shipped}

Order.get_purchased_attachments()[source]
Order.get_shipping_status_display(*moreargs, **morekwargs)
Order.get_status_display()[source]
Order.get_tax_summary()[source]
Return type:taxing.TaxSummary
Order.get_total_paid_amount()[source]
Order.get_unshipped_products()[source]
Order.is_complete()[source]
Order.is_paid()[source]
Order.lines
Order.log_entries
Order.objects = <django.db.models.manager.ManagerFromOrderQuerySet object>
Order.orderer
Order.payment_method
Order.payment_status

A placeholder class that provides a way to set the attribute on the model.

Order.payments
Order.save(*args, **kwargs)[source]
Order.set_canceled()[source]
Order.shipments
Order.shipping_address
Order.shipping_method
Order.shipping_status

A placeholder class that provides a way to set the attribute on the model.

Order.shop
Order.status
class shoop.core.models.OrderLine(id, order, product, supplier, parent_line, ordering, type, sku, text, accounting_identifier, require_verification, verified, extra_data, quantity, _unit_price_amount, _total_discount_amount, _prices_include_tax)[source]

Bases: django.db.models.base.Model, shoop.core.utils.prices.LinePriceMixin

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLine.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLine.child_lines
OrderLine.get_type_display(*moreargs, **morekwargs)
OrderLine.objects = <shoop.core.models.order_lines.OrderLineManager object>
OrderLine.order
OrderLine.parent_line
OrderLine.product
OrderLine.save(*args, **kwargs)[source]
OrderLine.supplier
OrderLine.taxes
OrderLine.total_discount

Total discount of OrderLine.

Return type:Price
OrderLine.total_tax_amount
Return type:decimal.Decimal
OrderLine.type

A placeholder class that provides a way to set the attribute on the model.

OrderLine.unit_price

Unit price of OrderLine.

Return type:Price
class shoop.core.models.OrderLineTax(id, order_line, tax, name, amount, base_amount, ordering)[source]

Bases: shoop.core.models._base.ShoopModel, shoop.core.taxing._line_tax.LineTax

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLineTax.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLineTax.objects = <django.db.models.manager.Manager object>
OrderLineTax.order_line
OrderLineTax.tax
class shoop.core.models.OrderLineType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.OrderLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shoop.utils.analog.BaseLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderLogEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderLogEntry.get_kind_display(*moreargs, **morekwargs)
OrderLogEntry.get_next_by_created_on(*moreargs, **morekwargs)
OrderLogEntry.get_previous_by_created_on(*moreargs, **morekwargs)
OrderLogEntry.kind

A placeholder class that provides a way to set the attribute on the model.

OrderLogEntry.logged_model

alias of Order

OrderLogEntry.objects = <django.db.models.manager.Manager object>
OrderLogEntry.target
OrderLogEntry.user
class shoop.core.models.OrderStatus(id, identifier, ordering, role, default)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception OrderStatus.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OrderStatus.get_role_display(*moreargs, **morekwargs)
OrderStatus.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

OrderStatus.objects = <django.db.models.manager.ManagerFromOrderStatusQuerySet object>
OrderStatus.order_set
OrderStatus.role

A placeholder class that provides a way to set the attribute on the model.

OrderStatus.save(*args, **kwargs)[source]
OrderStatus.translations
class shoop.core.models.OrderStatusRole[source]

Bases: enumfields.enums.Enum

class shoop.core.models.Payment(id, order, created_on, gateway_id, payment_identifier, amount, description)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Payment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Payment.get_next_by_created_on(*moreargs, **morekwargs)
Payment.get_previous_by_created_on(*moreargs, **morekwargs)
Payment.objects = <django.db.models.manager.Manager object>
Payment.order
class shoop.core.models.PaymentMethod(id, tax_class, status, identifier, module_identifier, module_data)[source]

Bases: shoop.core.models.methods.Method

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PaymentMethod.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PaymentMethod.contact_set
PaymentMethod.default_module_spec = 'shoop.core.methods.default:DefaultPaymentMethodModule'
PaymentMethod.get_payment_process_response(order, urls)[source]
PaymentMethod.get_status_display(*moreargs, **morekwargs)
PaymentMethod.line_type = <OrderLineType.PAYMENT: 3>
PaymentMethod.module_provides_key = 'payment_method_module'
PaymentMethod.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

PaymentMethod.objects = <django.db.models.manager.ManagerFromMethodQuerySet object>
PaymentMethod.payment_orders
PaymentMethod.payment_products
PaymentMethod.process_payment_return_request(order, request)[source]
PaymentMethod.shop_product_m2m = 'payment_methods'
PaymentMethod.status

A placeholder class that provides a way to set the attribute on the model.

PaymentMethod.tax_class
PaymentMethod.translations
PaymentMethod.type = <MethodType.PAYMENT: 2>
class shoop.core.models.PaymentStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.PersistentCacheEntry(id, module, key, time, data)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PersistentCacheEntry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PersistentCacheEntry.get_next_by_time(*moreargs, **morekwargs)
PersistentCacheEntry.get_previous_by_time(*moreargs, **morekwargs)
PersistentCacheEntry.objects = <django.db.models.manager.Manager object>
class shoop.core.models.PersonContact(id, polymorphic_ctype, created_on, identifier, is_active, default_shipping_address, default_billing_address, default_shipping_method, default_payment_method, language, marketing_permission, phone, www, timezone, prefix, name, suffix, name_ext, email, tax_group, contact_ptr, user, gender, birth_date)[source]

Bases: shoop.core.models.contacts.Contact

exception DoesNotExist

Bases: shoop.core.models.contacts.DoesNotExist

exception PersonContact.MultipleObjectsReturned

Bases: shoop.core.models.contacts.MultipleObjectsReturned

PersonContact.base_objects = <django.db.models.manager.Manager object>
PersonContact.contact_ptr
PersonContact.gender

A placeholder class that provides a way to set the attribute on the model.

PersonContact.get_gender_display(*moreargs, **morekwargs)
PersonContact.is_all_seeing
PersonContact.objects = <polymorphic.manager.PolymorphicManager object>
PersonContact.orderer_orders
PersonContact.polymorphic_primary_key_name = 'id'
PersonContact.polymorphic_super_sub_accessors_replaced = False
PersonContact.save(*args, **kwargs)[source]
PersonContact.user
class shoop.core.models.Product(id, created_on, modified_on, deleted, mode, variation_parent, stock_behavior, shipping_mode, sales_unit, tax_class, type, sku, gtin, barcode, accounting_identifier, profit_center, cost_center, category, width, height, depth, net_weight, gross_weight, purchase_price, suggested_retail_price, manufacturer, primary_image)[source]

Bases: shoop.core.models.attributes.AttributableMixin, parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Product.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Product.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Product.attributes
Product.category
Product.cross_sell_1
Product.cross_sell_2
Product.delete(using=None)[source]
Product.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.get_available_attribute_queryset()[source]
Product.get_base_price()[source]
Product.get_cheapest_child_price(context, quantity=1)[source]
Product.get_mode_display(*moreargs, **morekwargs)
Product.get_next_by_created_on(*moreargs, **morekwargs)
Product.get_next_by_modified_on(*moreargs, **morekwargs)
Product.get_package_child_to_quantity_map()[source]
Product.get_previous_by_created_on(*moreargs, **morekwargs)
Product.get_previous_by_modified_on(*moreargs, **morekwargs)
Product.get_price(context, quantity=1)[source]
Return type:shoop.core.pricing.Price
Product.get_shipping_mode_display(*moreargs, **morekwargs)
Product.get_shop_instance(shop)[source]
Return type:shoop.core.models.product_shops.ShopProduct
Product.get_stock_behavior_display(*moreargs, **morekwargs)
Product.get_taxed_price(context, quantity=1)[source]
Return type:shoop.core.pricing.TaxedPrice
Product.keywords

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.log_entries
Product.make_package(package_def)[source]
Product.manufacturer
Product.media
Product.mode

A placeholder class that provides a way to set the attribute on the model.

Product.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.objects = <django.db.models.manager.ManagerFromProductQuerySet object>
Product.order_lines
Product.primary_image
Product.sales_unit
Product.save(*args, **kwargs)[source]
Product.shipments
Product.shipping_mode

A placeholder class that provides a way to set the attribute on the model.

Product.shop_products
Product.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.soft_delete(user=None)[source]
Product.status_text

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.stock_behavior

A placeholder class that provides a way to set the attribute on the model.

Product.storedbasket_set
Product.suppliedproduct_set
Product.tax_class
Product.translations
Product.type
Product.variation_children
Product.variation_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.variation_parent
Product.variation_result_subs
Product.variation_result_supers
Product.variation_variables
Product.verify_mode()[source]
class shoop.core.models.Product(id, created_on, modified_on, deleted, mode, variation_parent, stock_behavior, shipping_mode, sales_unit, tax_class, type, sku, gtin, barcode, accounting_identifier, profit_center, cost_center, category, width, height, depth, net_weight, gross_weight, purchase_price, suggested_retail_price, manufacturer, primary_image)[source]

Bases: shoop.core.models.attributes.AttributableMixin, parler.models.TranslatableModel

COMMON_SELECT_RELATED = ('type', 'primary_image', 'tax_class')
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Product.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Product.add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
Product.attributes
Product.category
Product.cross_sell_1
Product.cross_sell_2
Product.delete(using=None)[source]
Product.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.get_available_attribute_queryset()[source]
Product.get_base_price()[source]
Product.get_cheapest_child_price(context, quantity=1)[source]
Product.get_mode_display(*moreargs, **morekwargs)
Product.get_next_by_created_on(*moreargs, **morekwargs)
Product.get_next_by_modified_on(*moreargs, **morekwargs)
Product.get_package_child_to_quantity_map()[source]
Product.get_previous_by_created_on(*moreargs, **morekwargs)
Product.get_previous_by_modified_on(*moreargs, **morekwargs)
Product.get_price(context, quantity=1)[source]
Return type:shoop.core.pricing.Price
Product.get_shipping_mode_display(*moreargs, **morekwargs)
Product.get_shop_instance(shop)[source]
Return type:shoop.core.models.product_shops.ShopProduct
Product.get_stock_behavior_display(*moreargs, **morekwargs)
Product.get_taxed_price(context, quantity=1)[source]
Return type:shoop.core.pricing.TaxedPrice
Product.keywords

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.link_to_parent(parent, variables=None)[source]
Product.log_entries
Product.make_package(package_def)[source]
Product.manufacturer
Product.media
Product.mode

A placeholder class that provides a way to set the attribute on the model.

Product.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.objects = <django.db.models.manager.ManagerFromProductQuerySet object>
Product.order_lines
Product.primary_image
Product.sales_unit
Product.save(*args, **kwargs)[source]
Product.shipments
Product.shipping_mode

A placeholder class that provides a way to set the attribute on the model.

Product.shop_products
Product.slug

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.soft_delete(user=None)[source]
Product.status_text

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.stock_behavior

A placeholder class that provides a way to set the attribute on the model.

Product.storedbasket_set
Product.suppliedproduct_set
Product.tax_class
Product.translations
Product.type
Product.unlink_from_parent()[source]
Product.variation_children
Product.variation_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Product.variation_parent
Product.variation_result_subs
Product.variation_result_supers
Product.variation_variables
Product.verify_mode()[source]
class shoop.core.models.ProductAttribute(id, attribute, numeric_value, datetime_value, untranslated_string_value, product)[source]

Bases: shoop.core.models.attributes.AppliedAttribute

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductAttribute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductAttribute.attribute
ProductAttribute.objects = <parler.managers.TranslatableManager object>
ProductAttribute.product
ProductAttribute.translated_string_value

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductAttribute.translations
class shoop.core.models.ProductCrossSell(id, product1, product2, weight, type)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductCrossSell.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductCrossSell.get_type_display(*moreargs, **morekwargs)
ProductCrossSell.objects = <django.db.models.manager.Manager object>
ProductCrossSell.product1
ProductCrossSell.product2
ProductCrossSell.type

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ProductCrossSellType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.ProductMedia(id, identifier, product, kind, file, external_url, ordering, enabled, public, purchased)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductMedia.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductMedia.description

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductMedia.easy_thumbnails_thumbnailer
ProductMedia.effective_title
ProductMedia.file
ProductMedia.get_kind_display(*moreargs, **morekwargs)
ProductMedia.kind

A placeholder class that provides a way to set the attribute on the model.

ProductMedia.objects = <parler.managers.TranslatableManager object>
ProductMedia.primary_image_for_products
ProductMedia.primary_image_for_shop_products
ProductMedia.product
ProductMedia.shops
ProductMedia.title

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductMedia.translations
ProductMedia.url
class shoop.core.models.ProductMediaKind[source]

Bases: enumfields.enums.Enum

class shoop.core.models.ProductMode[source]

Bases: enumfields.enums.Enum

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductPackageLink.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductPackageLink.child
ProductPackageLink.objects = <django.db.models.manager.Manager object>
ProductPackageLink.parent
class shoop.core.models.ProductType(id, identifier)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductType.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductType.attributes
ProductType.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductType.objects = <parler.managers.TranslatableManager object>
ProductType.products
ProductType.translations
class shoop.core.models.ProductVariationLinkStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.ProductVariationResult(id, product, combination_hash, result, status)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationResult.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationResult.get_status_display(*moreargs, **morekwargs)
ProductVariationResult.objects = <django.db.models.manager.Manager object>
ProductVariationResult.product
classmethod ProductVariationResult.resolve(parent_product, combination)[source]
ProductVariationResult.result
ProductVariationResult.status

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ProductVariationVariable(id, product, identifier)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationVariable.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationVariable.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductVariationVariable.objects = <parler.managers.TranslatableManager object>
ProductVariationVariable.product
ProductVariationVariable.translations
ProductVariationVariable.values
class shoop.core.models.ProductVariationVariableValue(id, variable, identifier)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ProductVariationVariableValue.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ProductVariationVariableValue.objects = <parler.managers.TranslatableManager object>
ProductVariationVariableValue.translations
ProductVariationVariableValue.value

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ProductVariationVariableValue.variable
class shoop.core.models.ProductVisibility[source]

Bases: enumfields.enums.Enum

class shoop.core.models.SalesUnit(id, identifier, decimals)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SalesUnit.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SalesUnit.allow_fractions
SalesUnit.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

SalesUnit.objects = <parler.managers.TranslatableManager object>
SalesUnit.product_set
SalesUnit.quantity_step

Get the quantity increment for the amount of decimals this unit allows.

For 0 decimals, this will be 1; for 1 decimal, 0.1; etc.

Returns:Decimal in (0..1]
Return type:Decimal
SalesUnit.round(value)[source]
SalesUnit.short_name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

SalesUnit.translations
class shoop.core.models.SavedAddress(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Model for saving multiple addresses in an ‘address book’ of sorts.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SavedAddress.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SavedAddress.address
SavedAddress.get_role_display(*moreargs, **morekwargs)
SavedAddress.get_status_display(*moreargs, **morekwargs)
SavedAddress.get_title()[source]

Returns the display title for this SavedAddress instance. Defaults to a short representation of the address.

This method should be used instead of accessing the title field directly when displaying SavedAddress objects.

SavedAddress.objects = <shoop.core.models.addresses.SavedAddressManager object>
SavedAddress.owner
SavedAddress.role

A placeholder class that provides a way to set the attribute on the model.

SavedAddress.status

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.SavedAddressRole[source]

Bases: enumfields.enums.Enum

class shoop.core.models.SavedAddressStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.Shipment(id, order, supplier, created_on, status, tracking_code, description, volume, weight)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Shipment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Shipment.cache_values()[source]

(Re)cache .volume and .weight for this Shipment from the ShipmentProducts within.

Shipment.get_next_by_created_on(*moreargs, **morekwargs)
Shipment.get_previous_by_created_on(*moreargs, **morekwargs)
Shipment.get_status_display(*moreargs, **morekwargs)
Shipment.objects = <django.db.models.manager.Manager object>
Shipment.order
Shipment.products
Shipment.status

A placeholder class that provides a way to set the attribute on the model.

Shipment.supplier
Shipment.total_products
class shoop.core.models.ShipmentProduct(id, shipment, product, quantity, unit_volume, unit_weight)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShipmentProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShipmentProduct.cache_values()[source]
ShipmentProduct.objects = <django.db.models.manager.Manager object>
ShipmentProduct.product
ShipmentProduct.shipment
class shoop.core.models.ShippingMethod(id, tax_class, status, identifier, module_identifier, module_data)[source]

Bases: shoop.core.models.methods.Method

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShippingMethod.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShippingMethod.contact_set
ShippingMethod.default_module_spec = 'shoop.core.methods.default:DefaultShippingMethodModule'
ShippingMethod.get_status_display(*moreargs, **morekwargs)
ShippingMethod.line_type = <OrderLineType.SHIPPING: 2>
ShippingMethod.module_provides_key = 'shipping_method_module'
ShippingMethod.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

ShippingMethod.objects = <django.db.models.manager.ManagerFromMethodQuerySet object>
ShippingMethod.shipping_orders
ShippingMethod.shipping_products
ShippingMethod.shop_product_m2m = 'shipping_methods'
ShippingMethod.status

A placeholder class that provides a way to set the attribute on the model.

ShippingMethod.tax_class
ShippingMethod.translations
ShippingMethod.type = <MethodType.SHIPPING: 1>
class shoop.core.models.ShippingMode[source]

Bases: enumfields.enums.Enum

class shoop.core.models.ShippingStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.Shop(id, identifier, domain, status, owner, options)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Shop.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Shop.categories
Shop.get_status_display(*moreargs, **morekwargs)
Shop.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Shop.objects = <parler.managers.TranslatableManager object>
Shop.order_set
Shop.owner
Shop.product_media
Shop.shop_products
Shop.simpleproductprice_set
Shop.status

A placeholder class that provides a way to set the attribute on the model.

Shop.translations
class shoop.core.models.ShopProduct(id, shop, product, visible, listed, purchasable, searchable, visibility_limit, purchase_multiple, minimum_purchase_quantity, limit_shipping_methods, limit_payment_methods, primary_category, shop_primary_image)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ShopProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ShopProduct.categories
ShopProduct.get_orderability_errors(supplier, quantity, customer, ignore_minimum=False)[source]

Yield ValidationErrors that would cause this product to not be orderable.

Parameters:
Returns:

Iterable[ValidationError]

ShopProduct.get_visibility_errors(customer)[source]
ShopProduct.get_visibility_limit_display(*moreargs, **morekwargs)
ShopProduct.images
ShopProduct.is_list_visible()[source]

Return True if this product should be visible in listings in general, without taking into account any other visibility limitations. :rtype: bool

ShopProduct.is_orderable(supplier, customer, quantity)[source]
ShopProduct.objects = <django.db.models.manager.Manager object>
ShopProduct.payment_methods
ShopProduct.primary_category
ShopProduct.primary_image
ShopProduct.product
ShopProduct.quantity_step

Quantity step for purchasing this product.

Return type:decimal.Decimal
Example:
<input type=”number” step=”{{ shop_product.quantity_step }}”>
ShopProduct.raise_if_not_orderable(supplier, customer, quantity, ignore_minimum=False)[source]
ShopProduct.raise_if_not_visible(customer)[source]
ShopProduct.rounded_minimum_purchase_quantity

The minimum purchase quantity, rounded to the sales unit’s precision.

Return type:decimal.Decimal
Example:
<input type=”number”
min=”{{ shop_product.rounded_minimum_purchase_quantity }}” value=”{{ shop_product.rounded_minimum_purchase_quantity }}”>
ShopProduct.shipping_methods
ShopProduct.shop
ShopProduct.shop_primary_image
ShopProduct.suppliers
ShopProduct.visibility_groups
ShopProduct.visibility_limit

A placeholder class that provides a way to set the attribute on the model.

class shoop.core.models.ShopStatus[source]

Bases: enumfields.enums.Enum

class shoop.core.models.StockBehavior[source]

Bases: enumfields.enums.Enum

class shoop.core.models.SuppliedProduct(id, supplier, product, sku, alert_limit, purchase_price, suggested_retail_price, physical_count, logical_count)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SuppliedProduct.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SuppliedProduct.objects = <django.db.models.manager.Manager object>
SuppliedProduct.product
SuppliedProduct.supplier
class shoop.core.models.Supplier(id, identifier, name, type, stock_managed, module_identifier, module_data)[source]

Bases: shoop.core.modules.interface.ModuleInterface, django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Supplier.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Supplier.adjust_stock(product_id, delta, created_by=None)[source]
Supplier.default_module_spec = 'shoop.core.suppliers:BaseSupplierModule'
Supplier.get_orderability_errors(shop_product, quantity, customer)[source]
Parameters:
Return type:

iterable[ValidationError]

Supplier.get_stock_status(product_id)[source]
Parameters:product_id (int) – Product ID
Return type:shoop.core.stocks.ProductStockStatus
Supplier.get_stock_statuses(product_ids)[source]
Parameters:product_ids – Iterable of product IDs
Returns:Dict of {product_id: ProductStockStatus}
Return type:dict[int, shoop.core.stocks.ProductStockStatus]
Supplier.get_type_display(*moreargs, **morekwargs)
Supplier.module_provides_key = 'supplier_module'
Supplier.objects = <django.db.models.manager.Manager object>
Supplier.order_lines
Supplier.shipments
Supplier.shop_products
Supplier.stockadjustment_set
Supplier.stockcount_set
Supplier.suppliedproduct_set
Supplier.type

A placeholder class that provides a way to set the attribute on the model.

Supplier.update_stock(product_id)[source]
Supplier.update_stocks(product_ids)[source]
class shoop.core.models.SupplierType[source]

Bases: enumfields.enums.Enum

class shoop.core.models.Tax(id, code, rate, amount, enabled)[source]

Bases: shoop.core.models._base.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Tax.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Tax.calculate_amount(base_amount)[source]
Tax.clean()[source]
Tax.identifier_attr = 'code'
Tax.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Tax.objects = <parler.managers.TranslatableManager object>
Tax.order_line_taxes
Tax.save(*args, **kwargs)[source]
Tax.taxrule_set
Tax.translations
class shoop.core.models.TaxClass(id, identifier, enabled)[source]

Bases: shoop.core.models._base.TranslatableShoopModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception TaxClass.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

TaxClass.name

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

TaxClass.objects = <parler.managers.TranslatableManager object>
TaxClass.paymentmethod_set
TaxClass.product_set
TaxClass.shippingmethod_set
TaxClass.taxrule_set
TaxClass.translations
shoop.core.modules package
Submodules
shoop.core.modules.interface module
class shoop.core.modules.interface.ModuleInterface[source]

Bases: object

default_module_spec = None
classmethod get_module_choices(empty_label=None)[source]
classmethod get_module_implementation_map()[source]

Get a dict that maps module spec identifiers (short strings) into actual spec names.

As an example:

>>> {"Eggs": "foo_package.bar_module:EggsClass"}
Return type:dict[str, str]
module
module_identifier = None
module_options_field = 'module_data'
module_provides_key = None
exception shoop.core.modules.interface.ModuleNotFound[source]

Bases: ValueError

Module contents
class shoop.core.modules.ModuleInterface[source]

Bases: object

default_module_spec = None
classmethod get_module_choices(empty_label=None)[source]
classmethod get_module_implementation_map()[source]

Get a dict that maps module spec identifiers (short strings) into actual spec names.

As an example:

>>> {"Eggs": "foo_package.bar_module:EggsClass"}
Return type:dict[str, str]
module
module_identifier = None
module_options_field = 'module_data'
module_provides_key = None
shoop.core.order_creator package
Submodules
shoop.core.order_creator.creator module
class shoop.core.order_creator.creator.OrderCreator(request)[source]

Bases: object

add_line_taxes(lines)[source]
add_lines_into_order(order, lines)[source]
create_order(order_source)[source]
create_package_children(order_line)[source]
get_creator(order_source)[source]
get_source_order_lines(source, order)[source]
process_order_after_lines(source, order)[source]
process_order_before_lines(source, order)[source]
process_saved_order_line(order, order_line)[source]

Called in sequence for all order lines to be saved into the order. These have all been saved, so they have PKs. :type order: Order :type order_line: OrderLine

source_line_to_order_lines(order, source_line)[source]

Convert a SourceLine into one or more OrderLines (yield them) :param order: The order :param source_line: The SourceLine

shoop.core.order_creator.creator.real_user_or_none(user)[source]
shoop.core.order_creator.source module
class shoop.core.order_creator.source.OrderSource[source]

Bases: object

A “provisional order” object.

Contains data that’s not strictly about a basket’s contents, but is useful for things that need to calculate something based on the basket’s contents and extra data, such as shipping/billing addresses.

The core API of OrderCreator reads an OrderSource.

No objects held here need be saved, but they may be.

get_final_lines()[source]
get_lines()[source]
get_validation_errors()[source]
payment_method
prices_include_tax()[source]
product_total_price
shipping_method
status
taxful_product_total_price
taxful_total_price
taxless_product_total_price
taxless_total_price
total_price
uncache()[source]

Uncache processed lines.

Should be called after changing the contents before (re)accessing lines with get_final_lines.

update(**values)[source]
update_from_order(order)[source]
class shoop.core.order_creator.source.SourceLine(source=None, **kwargs)[source]

Bases: shoop.core.utils.prices.LinePriceMixin

classmethod from_dict(source, data)[source]

Create SourceLine from given OrderSource and dict.

Return type:cls
get(key, default=None)[source]
get_tax_class()[source]
to_dict()[source]
total_tax_amount
Return type:decimal.Decimal
update(**kwargs)[source]
shoop.core.order_creator.source.sum_taxful_totals(lines)[source]
shoop.core.order_creator.source.sum_taxless_totals(lines)[source]
Module contents
class shoop.core.order_creator.OrderCreator(request)[source]

Bases: object

add_line_taxes(lines)[source]
add_lines_into_order(order, lines)[source]
create_order(order_source)[source]
create_package_children(order_line)[source]
get_creator(order_source)[source]
get_source_order_lines(source, order)[source]
process_order_after_lines(source, order)[source]
process_order_before_lines(source, order)[source]
process_saved_order_line(order, order_line)[source]

Called in sequence for all order lines to be saved into the order. These have all been saved, so they have PKs. :type order: Order :type order_line: OrderLine

source_line_to_order_lines(order, source_line)[source]

Convert a SourceLine into one or more OrderLines (yield them) :param order: The order :param source_line: The SourceLine

class shoop.core.order_creator.OrderSource[source]

Bases: object

A “provisional order” object.

Contains data that’s not strictly about a basket’s contents, but is useful for things that need to calculate something based on the basket’s contents and extra data, such as shipping/billing addresses.

The core API of OrderCreator reads an OrderSource.

No objects held here need be saved, but they may be.

get_final_lines()[source]
get_lines()[source]
get_validation_errors()[source]
payment_method
prices_include_tax()[source]
product_total_price
shipping_method
status
taxful_product_total_price
taxful_total_price
taxless_product_total_price
taxless_total_price
total_price
uncache()[source]

Uncache processed lines.

Should be called after changing the contents before (re)accessing lines with get_final_lines.

update(**values)[source]
update_from_order(order)[source]
class shoop.core.order_creator.SourceLine(source=None, **kwargs)[source]

Bases: shoop.core.utils.prices.LinePriceMixin

classmethod from_dict(source, data)[source]

Create SourceLine from given OrderSource and dict.

Return type:cls
get(key, default=None)[source]
get_tax_class()[source]
to_dict()[source]
total_tax_amount
Return type:decimal.Decimal
update(**kwargs)[source]
shoop.core.pricing package
Module contents

Shoop modular product pricing functionality.

The pricing module in use is declared by the SHOOP_PRICING_MODULE setting. The default is a pricing module that always prices everything to be free. The base distribution contains shoop.simple_pricing, which is an useful pricing module for many cases.

To acquire an instance of the current pricing module, use get_pricing_module.

In brief, a pricing module is able to price a product based on a context; what exactly a context contains is determined by the module in question. You can construct a context from a request by calling the module’s get_context_from_request method, or for more advanced uses, when you do not have access to an HTTP request, get_context_from_data.

After you have acquired the module and a context, you can calculate prices for a product with the module’s get_price method. (Product objects contain the convenience method get_price which do these steps for you.)

If you have multiple products, it will likely be more efficient – depending on the implementation of the module – to use the get_prices method.

TODO: document the concepts of base price and the pricing steps API. TODO: caching.

class shoop.core.pricing.Price[source]

Bases: shoop.utils.money.Money

amount
classmethod from_value(value, includes_tax)[source]
includes_tax = None
class shoop.core.pricing.PricingContext(**kwargs)[source]

Bases: object

REQUIRED_VALUES = ()
cache_key
get_cache_key()[source]
get_cache_key_parts()[source]
class shoop.core.pricing.PricingModule[source]

Bases: object

get_base_price(product_id)[source]

Get base Price for the given product.

May return TaxlessPrice or TaxfulPrice.

Return type:Price
get_base_prices(product_ids)[source]
get_context(context)[source]
Return type:PricingContext
get_context_from_data(**context_data)[source]
get_context_from_request(request)[source]
get_price(context, product_id, quantity=1)[source]

Get context-specific Price for the given product and quantity.

May return TaxlessPrice or TaxfulPrice.

Return type:Price
get_prices(context, product_ids, quantity=1)[source]
get_pricing_steps(context, product_id)[source]

Get context-specific list pricing steps for the given product.

Returns a list of tuples

[(0, price0), (quantity1, price1), (quantity2, price2), ...]

where price for 0 <= quantity < quantity1 is price0, and price for quantity1 <= quantity < quantity2 is price1, and so on.

If there are “no steps”, the return value will be a list of single step with the constant price, i.e. [(0, price)].

Return type:list[tuple[Decimal,Price]]
get_pricing_steps_for_products(context, product_ids)[source]
identifier = None
name = None
pricing_context_class

alias of PricingContext

class shoop.core.pricing.TaxfulPrice[source]

Bases: shoop.core.pricing.price.Price

includes_tax = True
class shoop.core.pricing.TaxlessPrice[source]

Bases: shoop.core.pricing.price.Price

includes_tax = False
shoop.core.pricing.get_pricing_module()[source]
Return type:shoop.core.pricing.PricingModule
shoop.core.shortcuts package
Module contents
shoop.core.shortcuts.update_order_line_from_product(request, order_line, product, quantity=1, supplier=None)[source]

This is a convenience method for simple applications.

shoop.core.stocks package
Module contents
class shoop.core.stocks.ProductStockStatus(product=None, product_id=None, logical_count=0, physical_count=0, message=None, error=None)[source]

Bases: shoop.core.utils.product_caching_object.ProductCachingObject

shoop.core.suppliers package
Submodules
shoop.core.suppliers.base module
class shoop.core.suppliers.base.BaseSupplierModule(supplier, options)[source]

Bases: object

Base supplier module implementation.

adjust_stock(product_id, delta, created_by=None)[source]
get_orderability_errors(shop_product, quantity, customer)[source]
Parameters:
Return type:

iterable[ValidationError]

get_stock_status(product_id)[source]
Parameters:product_id (int) – Product ID
Return type:shoop.core.stocks.ProductStockStatus
get_stock_statuses(product_ids)[source]
Parameters:product_ids – Iterable of product IDs
Returns:Dict of {product_id: ProductStockStatus}
Return type:dict[int, shoop.core.stocks.ProductStockStatus]
identifier = None
name = None
update_stock(product_id)[source]
update_stocks(product_ids)[source]
Module contents
class shoop.core.suppliers.BaseSupplierModule(supplier, options)[source]

Bases: object

Base supplier module implementation.

adjust_stock(product_id, delta, created_by=None)[source]
get_orderability_errors(shop_product, quantity, customer)[source]
Parameters:
Return type:

iterable[ValidationError]

get_stock_status(product_id)[source]
Parameters:product_id (int) – Product ID
Return type:shoop.core.stocks.ProductStockStatus
get_stock_statuses(product_ids)[source]
Parameters:product_ids – Iterable of product IDs
Returns:Dict of {product_id: ProductStockStatus}
Return type:dict[int, shoop.core.stocks.ProductStockStatus]
identifier = None
name = None
update_stock(product_id)[source]
update_stocks(product_ids)[source]
shoop.core.templatetags package
Submodules
shoop.core.templatetags.shoop_common module
shoop.core.templatetags.shoop_common.datetime(value, kind='datetime', format='medium', tz=True)[source]

Format a datetime for human consumption.

The currently active locale’s formatting rules are used. The output of this function is probably not machine-parseable.

Parameters:
  • value (datetime.datetime) – datetime object to format
  • kind (str) – Format as ‘datetime’, ‘date’ or ‘time’
  • format (str) – Format specifier or one of ‘full’, ‘long’, ‘medium’ or ‘short’
  • tz (bool|str) –

    Convert to current or given timezone. Accepted values are:

    True (default)
    convert to currently active timezone (as reported by django.utils.timezone.get_current_timezone)
    False (or other false value like empty string)
    do no convert to any timezone (use UTC)
    Other values (as str)
    convert to given timezone (e.g. "US/Hawaii")
shoop.core.templatetags.shoop_common.home_currency(value)[source]
shoop.core.templatetags.shoop_common.json(value)[source]
shoop.core.templatetags.shoop_common.number(value)[source]
shoop.core.templatetags.shoop_common.percent(value, ndigits=3)[source]
Module contents
shoop.core.utils package
Submodules
shoop.core.utils.model_caching_descriptor module
class shoop.core.utils.model_caching_descriptor.ModelCachingDescriptor(name, queryset)[source]

Bases: object

get_id(instance)[source]
get_object(instance)[source]
set_id(instance, value)[source]
set_object(instance, value)[source]
shoop.core.utils.name_mixin module
class shoop.core.utils.name_mixin.NameMixin[source]

Bases: object

first_name
full_name
last_name
split_name
shoop.core.utils.product_caching_object module
class shoop.core.utils.product_caching_object.ProductCachingObject[source]

Bases: object

product
product_id
shoop.core.utils.query module
shoop.core.utils.query.group_by_period(queryset, column, period, **annotate)[source]

Group and annotate given queryset by a given date period.

Parameters:
  • queryset (django.db.QuerySet) – Original queryset
  • column (str) – Column for grouping
  • period (str) – Period for grouping (‘year’, ‘month’, ‘day’)
  • annotate (dict[str,str]) – Dict for .annotate()
Returns:

OrderedDict of period -> annotate columns

Return type:

collections.OrderedDict

shoop.core.utils.reference module
shoop.core.utils.reference.calc_reference_number_checksum(rn)[source]
shoop.core.utils.reference.get_order_identifier(order)[source]
shoop.core.utils.reference.get_reference_number(order)[source]
shoop.core.utils.reference.get_running_reference_number(order)[source]
shoop.core.utils.reference.get_shop_running_reference_number(order)[source]
shoop.core.utils.reference.get_unique_reference_number(order)[source]
shoop.core.utils.slugs module
shoop.core.utils.slugs.generate_multilanguage_slugs(object, name_getter, slug_length=128)[source]
shoop.core.utils.vat module
shoop.core.utils.vat.compile_pattern(prefix, pattern)[source]
shoop.core.utils.vat.get_vat_prefix_for_country(iso3166)[source]
shoop.core.utils.vat.verify_vat(vat_id, default_prefix='')[source]

Verify an EU VAT ID.

Returns a tuple (prefix, code_parts) – if both are truthy, the validation succeeded. If the prefix part is falsy, then the prefix was unknown and no validation was even attempted. If the prefix part is truthy, then it will contain the country prefix used for validation. The code_parts part can still be falsy, if the validation for the country’s VAT number pattern failed.

Parameters:
  • vat_id (str) – The VAT ID string to validate.
  • default_prefix (str) – The default prefix to assume if none can be parsed.
Returns:

Tuple of (prefix, code_parts)

Module contents
Submodules
shoop.core.excs module
exception shoop.core.excs.ImmutabilityError[source]

Bases: ValueError

exception shoop.core.excs.NoPaymentToCreateException[source]

Bases: Exception

exception shoop.core.excs.NoProductsToShipException[source]

Bases: Exception

exception shoop.core.excs.ProductNotOrderableProblem(message, title=None)[source]

Bases: shoop.utils.excs.Problem

exception shoop.core.excs.ProductNotVisibleProblem(message, title=None)[source]

Bases: shoop.utils.excs.Problem

shoop.core.settings module
shoop.core.settings.SHOOP_ADDRESS_HOME_COUNTRY = None

The home country code (ISO 3166-1 alpha 2) for the Shoop installation. Among other things, addresses that would be printed with this country visible are printed with no country.

shoop.core.settings.SHOOP_ALLOW_ANONYMOUS_ORDERS = True

Whether or not anonymous orders (without a creator user) are allowed.

shoop.core.settings.SHOOP_DEFAULT_ORDER_LABEL = 'default'

The order label (see SHOOP_ORDER_LABELS) to apply to orders by default. This should naturally be one of the keys in SHOOP_ORDER_LABELS.

shoop.core.settings.SHOOP_ENABLE_ATTRIBUTES = True

Whether product attributes are enabled. For installations not requiring attributes, disabling this may confer a small performance increase.

shoop.core.settings.SHOOP_ENABLE_MULTIPLE_SHOPS = False

Whether multiple shops are expected to be enabled in this installation. Enabling or disabling this flag does not make it (im)possible to set up multiple shops, but having it disabled may confer a small performance increase.

shoop.core.settings.SHOOP_HOME_CURRENCY = 'EUR'

The home currency for the Shoop installation. All monetary values are implicitly in this currency unless somehow otherwise specified.

shoop.core.settings.SHOOP_ORDER_IDENTIFIER_METHOD = 'id'

Which method is used to calculate order identifiers (“order numbers”). May be either the string “id”, a callable or a spec string pointing to a callable that must return a string given an order.

shoop.core.settings.SHOOP_ORDER_KNOWN_EXTRA_DATA_KEYS = []

A list of “known keys” within the Order.extra_data property bag.

The format of this setting is a list of 2-tuples of dict key / visible name, for example [("wrapping_color", "Wrapping Paper Color")].

For installations where customizations may save some human-readable, possibly important information in extra_data, this setting may be used to make this data easily visible in the administration backend.

shoop.core.settings.SHOOP_ORDER_KNOWN_PAYMENT_DATA_KEYS = []

A list of “known keys” within the Order.payment_data property bag.

The format of this setting is a list of 2-tuples of dict key / visible name, for example [("ssn", "Social Security Number")].

For installations where customizations may save some human-readable, possibly important information in payment_data, this setting may be used to make this data easily visible in the administration backend.

shoop.core.settings.SHOOP_ORDER_KNOWN_SHIPPING_DATA_KEYS = []

A list of “known keys” within the Order.shipping_data property bag.

The format of this setting is a list of 2-tuples of dict key / visible name, for example [("shipping_instruction", "Special Shipping Instructions")].

For installations where customizations may save some human-readable, possibly important information in shipping_data, this setting may be used to make this data easily visible in the administration backend.

shoop.core.settings.SHOOP_ORDER_LABELS = [('default', 'Default')]

A list of order labels (2-tuples of internal identifier / visible name).

Order labels serve as a simple taxonomy layer for easy “tagging” of orders even within a single Shop. For instance, an installation could define "default" and "internal" order labels, which are then usable in reports, admin filtering, etc.

shoop.core.settings.SHOOP_ORDER_LINE_TOTAL_DECIMALS = 2

TODO: Document SHOOP_ORDER_LINE_TOTAL_DECIMALS

shoop.core.settings.SHOOP_ORDER_TOTAL_DECIMALS = 2

TODO: Document SHOOP_ORDER_TOTAL_DECIMALS

shoop.core.settings.SHOOP_PRICING_MODULE = 'simple_pricing'

The identifier of the pricing module to use for pricing products.

Determines how product prices are calculated. See shoop.core.pricing for details.

shoop.core.settings.SHOOP_REFERENCE_NUMBER_LENGTH = 10

The length of reference numbers generated by certain reference number generators.

shoop.core.settings.SHOOP_REFERENCE_NUMBER_METHOD = 'unique'

Which method is used to calculate order reference numbers. May be a spec string pointing to a callable that must return a string given an order, or one of the following built-in generators. unique

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/shoop-1.1.0-py3.4.egg/shoop/core/settings.py:docstring of shoop.core.settings.SHOOP_REFERENCE_NUMBER_METHOD, line 5)

Unexpected indentation.
Unique reference number based on time and the order ID. The reference number has the Finnish bank reference check digit appended, making the reference number valid for Finnish bank transfers.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/shoop-1.1.0-py3.4.egg/shoop/core/settings.py:docstring of shoop.core.settings.SHOOP_REFERENCE_NUMBER_METHOD, line 8)

Block quote ends without a blank line; unexpected unindent.
running
Ascending reference number. The length of the reference number will be SHOOP_REFERENCE_NUMBER_LENGTH + 1 (for the check digit described below). SHOOP_REFERENCE_NUMBER_PREFIX is prepended, if set. The reference number has the Finnish bank reference check digit appended, making the reference number valid for Finnish bank transfers.
shop_running
As running, but with the shop ID prepended.
shoop.core.settings.SHOOP_REFERENCE_NUMBER_PREFIX = ''

An arbitrary (numeric) prefix for certain reference number generators.

shoop.core.settings.SHOOP_TAX_MODULE = 'default_tax'

The identifier of the tax module to use for determining taxes of products and order lines.

Determines taxing rules for products, shipping/payment methods and other order lines. See shoop.core.taxing for details.

shoop.core.settings.SHOOP_TELEMETRY_ENABLED = True

A flag to enable/disable the telemetry system

shoop.core.settings.SHOOP_TELEMETRY_URL = 'https://telemetry.shoop.io/collect/'

The submission URL for Shoop’s telemetry (statistics) system

shoop.core.signals module
Module contents
class shoop.core.ShoopCoreAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop'
name = 'shoop.core'
provides = {'api_populator': ['shoop.core.api:populate_core_api']}
required_installed_apps = ('django.contrib.auth', 'django.contrib.contenttypes', 'easy_thumbnails', 'filer')
verbose_name = 'Shoop Core'
shoop.front package
Subpackages
shoop.front.apps package
Subpackages
shoop.front.apps.auth package
Submodules
shoop.front.apps.auth.urls module
shoop.front.apps.auth.views module
class shoop.front.apps.auth.views.LoginView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

form_class

alias of AuthenticationForm

form_valid(form)[source]
get_success_url()[source]
template_name = 'shoop/user/login.jinja'
class shoop.front.apps.auth.views.LogoutView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

dispatch(request, *args, **kwargs)[source]
template_name = 'shoop/user/logout.jinja'
class shoop.front.apps.auth.views.RecoverPasswordCompleteView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

template_name = 'shoop/user/recover_password_complete.jinja'
class shoop.front.apps.auth.views.RecoverPasswordConfirmView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

dispatch(request, *args, **kwargs)[source]
form_class

alias of SetPasswordForm

form_valid(form)[source]
get_form_kwargs()[source]
get_target_user()[source]
success_url = <django.utils.functional.lazy.<locals>.__proxy__ object>
template_name = 'shoop/user/recover_password_confirm.jinja'
token_generator = <django.contrib.auth.tokens.PasswordResetTokenGenerator object>
class shoop.front.apps.auth.views.RecoverPasswordForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict([('email', <django.forms.fields.EmailField object at 0x7fde3e79a1d0>)])
declared_fields = OrderedDict([('email', <django.forms.fields.EmailField object at 0x7fde3e79a1d0>)])
email_template_name = 'shoop/user/recover_password_mail_content.jinja'
from_email = None
media
process_user(user)[source]
save(request)[source]
subject_template_name = ('shoop/user/recover_password_mail_subject.jinja',)
token_generator = <django.contrib.auth.tokens.PasswordResetTokenGenerator object>
class shoop.front.apps.auth.views.RecoverPasswordSentView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

template_name = 'shoop/user/recover_password_sent.jinja'
class shoop.front.apps.auth.views.RecoverPasswordView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

form_class

alias of RecoverPasswordForm

form_valid(form)[source]
success_url = <django.utils.functional.lazy.<locals>.__proxy__ object>
template_name = 'shoop/user/recover_password.jinja'
Module contents
class shoop.front.apps.auth.AuthAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_front.auth'
name = 'shoop.front.apps.auth'
provides = {'front_urls': ['shoop.front.apps.auth.urls:urlpatterns']}
verbose_name = 'Shoop Frontend - User Authentication'
shoop.front.apps.customer_information package
Submodules
shoop.front.apps.customer_information.urls module
shoop.front.apps.customer_information.views module
class shoop.front.apps.customer_information.views.AddressForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('name', 'phone', 'email', 'street', 'street2', 'postal_code', 'city', 'region', 'country')
model

alias of Address

AddressForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3c418710>), ('phone', <django.forms.fields.CharField object at 0x7fde3c3650f0>), ('email', <django.forms.fields.EmailField object at 0x7fde3c365160>), ('street', <django.forms.fields.CharField object at 0x7fde3c365518>), ('street2', <django.forms.fields.CharField object at 0x7fde3c365588>), ('postal_code', <django.forms.fields.CharField object at 0x7fde3c5dd0b8>), ('city', <django.forms.fields.CharField object at 0x7fde3c5dd898>), ('region', <django.forms.fields.CharField object at 0x7fde3c5ddb38>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7fde3c586ac8>)])
AddressForm.declared_fields = OrderedDict()
AddressForm.media
class shoop.front.apps.customer_information.views.CustomerEditView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

form_valid(form)[source]
get_form(form_class=None)
template_name = 'shoop/customer_information/edit.jinja'
class shoop.front.apps.customer_information.views.PersonContactForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('name', 'phone', 'email', 'gender', 'marketing_permission')
model

alias of PersonContact

PersonContactForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object at 0x7fde3c418da0>), ('phone', <django.forms.fields.CharField object at 0x7fde3c418898>), ('email', <django.forms.fields.EmailField object at 0x7fde3c418ac8>), ('gender', <enumfields.forms.EnumChoiceField object at 0x7fde3c4189e8>), ('marketing_permission', <django.forms.fields.BooleanField object at 0x7fde3c418588>)])
PersonContactForm.declared_fields = OrderedDict()
PersonContactForm.media
Module contents
class shoop.front.apps.customer_information.AppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_front.customer_information'
name = 'shoop.front.apps.customer_information'
provides = {'front_urls': ['shoop.front.apps.customer_information.urls:urlpatterns']}
verbose_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.front.apps.personal_order_history package
Submodules
shoop.front.apps.personal_order_history.urls module
shoop.front.apps.personal_order_history.views module
class shoop.front.apps.personal_order_history.views.OrderDetailView(**kwargs)[source]

Bases: shoop.front.apps.personal_order_history.views.OrderViewMixin, django.views.generic.detail.DetailView

context_object_name = 'order'
template_name = 'shoop/personal_order_history/order_detail.jinja'
class shoop.front.apps.personal_order_history.views.OrderListView(**kwargs)[source]

Bases: shoop.front.apps.personal_order_history.views.OrderViewMixin, django.views.generic.list.ListView

context_object_name = 'orders'
template_name = 'shoop/personal_order_history/order_list.jinja'
class shoop.front.apps.personal_order_history.views.OrderViewMixin[source]

Bases: object

get_queryset()[source]
model

alias of Order

Module contents
class shoop.front.apps.personal_order_history.AppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_front.personal_order_history'
name = 'shoop.front.apps.personal_order_history'
provides = {'front_urls': ['shoop.front.apps.personal_order_history.urls:urlpatterns']}
verbose_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.front.apps.registration package
Submodules
shoop.front.apps.registration.settings module
shoop.front.apps.registration.settings.SHOOP_REGISTRATION_REQUIRES_ACTIVATION = True

Require email-based activation for users?

This corresponds to using the default or simple django-registration backends.

shoop.front.apps.registration.urls module
shoop.front.apps.registration.views module
class shoop.front.apps.registration.views.ActivationView(**kwargs)[source]

Bases: registration.backends.default.views.ActivationView

get_success_url(request, user)[source]
template_name = 'shoop/registration/activation_failed.jinja'
class shoop.front.apps.registration.views.RegistrationNoActivationView(**kwargs)[source]

Bases: shoop.front.apps.registration.views.RegistrationViewMixin, registration.backends.simple.views.RegistrationView

class shoop.front.apps.registration.views.RegistrationView(**kwargs)[source]

Bases: django.views.generic.base.View

dispatch(request, *args, **kwargs)[source]
class shoop.front.apps.registration.views.RegistrationViewMixin[source]

Bases: object

get_success_url(request, user)[source]
template_name = 'shoop/registration/register.jinja'
class shoop.front.apps.registration.views.RegistrationWithActivationView(**kwargs)[source]

Bases: shoop.front.apps.registration.views.RegistrationViewMixin, registration.backends.default.views.RegistrationView

shoop.front.apps.registration.views.activation_complete(request)[source]
shoop.front.apps.registration.views.registration_complete(request)[source]
Module contents
Shoop Registration Add-on

The shoop.front.apps.registration add-on provides simple user registration and email token based activation.

It is based on the django-registration-redux package.

Installation

Add registration and shoop.front.apps.registration into your INSTALLED_APPS (and run migrations, of course).

The application registers its URLs via the front_urls provides mechanism.

URL names
  • shoop:registration_register – the entry point for registration.
class shoop.front.apps.registration.RegistrationAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_front.registration'
name = 'shoop.front.apps.registration'
provides = {'front_urls': ['shoop.front.apps.registration.urls:urlpatterns']}
ready()[source]
required_installed_apps = {'registration': 'django-registration-redux is required for user registration and activation'}
verbose_name = 'Shoop Frontend - User Registration'
shoop.front.apps.simple_order_notification package
Submodules
shoop.front.apps.simple_order_notification.templates module
Module contents
class shoop.front.apps.simple_order_notification.SimpleOrderNotificationAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_front.simple_order_notification'
name = 'shoop.front.apps.simple_order_notification'
provides = {'admin_module': ['shoop.front.apps.simple_order_notification.admin_module:SimpleOrderNotificationModule']}
ready()[source]
verbose_name = 'Shoop Frontend - Simple Order Notification'
shoop.front.apps.simple_order_notification.send_simple_order_notification(sender, order, request, **kwargs)[source]
Parameters:order (shoop.core.models.Order) – Order
shoop.front.apps.simple_search package
Submodules
shoop.front.apps.simple_search.urls module
shoop.front.apps.simple_search.views module
class shoop.front.apps.simple_search.views.SearchForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict([('q', <django.forms.fields.CharField object at 0x7fde3c42bdd8>), ('sort', <django.forms.fields.CharField object at 0x7fde3c42bf28>)])
clean()[source]
declared_fields = OrderedDict([('q', <django.forms.fields.CharField object at 0x7fde3c42bdd8>), ('sort', <django.forms.fields.CharField object at 0x7fde3c42bf28>)])
media
class shoop.front.apps.simple_search.views.SearchView(**kwargs)[source]

Bases: django.views.generic.list.ListView

context_object_name = 'products'
dispatch(request, *args, **kwargs)[source]
form_class

alias of SearchForm

get_context_data(**kwargs)[source]
get_queryset()[source]
model

alias of Product

template_name = 'shoop/simple_search/search.jinja'
shoop.front.apps.simple_search.views.get_search_product_ids(request, query)[source]
Module contents
shoop.front.basket package
Submodules
shoop.front.basket.command_dispatcher module
class shoop.front.basket.command_dispatcher.BasketCommandDispatcher(request, basket=None)[source]

Bases: object

BasketCommandDispatcher handles (usually AJAX) requests that somehow update the basket. You should never instantiate BasketCommandDispatcher yourself – instead use get_basket_command_dispatcher().

All handle_* methods are expected to accept **kwargs.

commands_module = <module 'shoop.front.basket.commands' from '/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/shoop-1.1.0-py3.4.egg/shoop/front/basket/commands.py'>
get_command_handler(command)[source]
handle(command, kwargs=None)[source]

Dispatch and handle processing of the given command.

Parameters:
  • command (unicode) – Name of command to run
  • kwargs (dict) – Arguments to pass to the command handler. If empty, request.POST is used.
Returns:

response

Return type:

HttpResponse

postprocess_response(command, kwargs, response)[source]

Postprocess the response dictionary (not a HTTP response!) before it is either turned into JSON or otherwise processed (in the case of non-AJAX requests).

Parameters:
  • command – The command that was run.
  • kwargs – The actual kwargs the command was run with.
  • response – The response the command returned.
Returns:

The response to be processed and sent to the client.

preprocess_kwargs(command, kwargs)[source]

Preprocess kwargs before they are passed to the given command handler. Useful for subclassing. Must return the new kwargs, even if it wasn’t mutated.

Parameters:
  • command – The name of the command about to be run
  • kwargs – dict of arguments
Returns:

dict of arguments

shoop.front.basket.commands module
shoop.front.basket.commands.handle_add(request, basket, product_id, quantity=1, supplier_id=None, **kwargs)[source]

Handle adding a product to the basket.

Parameters:
  • product_id – product ID to add (or if child_product_id is truey, the parent ID)
  • quantity – quantity of products to add
  • child_product_id – child product ID to add (if truey)
  • supplier_id – The supplier ID for the new line. If None, the first supplier is used.
shoop.front.basket.commands.handle_add_var(request, basket, quantity=1, **kwargs)[source]

Handle adding a complex variable product into the basket by resolving the combination variables. This actually uses kwargs, expecting var_XXX=YYY to exist there, where XXX is the PK of a ProductVariationVariable and YYY is the PK of a ProductVariationVariableValue. Confused yet?

Parameters:
  • quantity – Quantity of the resolved variation to add.
  • kwargs – Expected to contain var_* values, see above.
shoop.front.basket.commands.handle_clear(request, basket, **kwargs)[source]

Handle fully clearing the basket.

shoop.front.basket.commands.handle_del(request, basket, line_id, **kwargs)[source]

Handle deleting a distinct order line from the basket given its unique line ID.

Parameters:line_id – The line ID to delete.
Returns:
shoop.front.basket.commands.handle_update(request, basket, **kwargs)[source]

Handle updating a basket, i.e. deleting some lines or updating quantities.

This dispatches further to whatever is declared by the SHOOP_BASKET_UPDATE_METHODS_SPEC configuration entry.

shoop.front.basket.objects module
class shoop.front.basket.objects.BaseBasket(request, basket_name='basket')[source]

Bases: shoop.core.order_creator.source.OrderSource

add_product(supplier, shop, product, quantity, force_new_line=False, extra=None, parent_line=None)[source]
add_product_with_child_product(supplier, shop, product, child_product, quantity)[source]
clean_empty_lines()[source]
clear_all()[source]

Clear all data for this basket.

delete()[source]

Clear and delete the basket data.

delete_line(line_id)[source]
finalize()[source]

Mark the basket as “completed” (i.e. an order is created/a conversion made).

This will also clear the basket’s data.

find_line_by_line_id(line_id)[source]
find_lines_by_parent_line_id(parent_line_id)[source]
get_available_payment_methods(shop)[source]

Get available payment methods for given shop.

Return type:list[PaymentMethod]
get_available_shipping_methods(shop)[source]

Get available shipping methods for given shop.

Return type:list[ShippingMethod]
get_lines()[source]
get_product_ids_and_quantities()[source]
get_validation_errors(shop)[source]
is_empty
load()[source]

Get the currently persisted data for this basket.

This will only access the storage once per request in usual circumstances.

Returns:Data dict.
Return type:dict
orderable
product_count
product_ids
save()[source]

Persist any changes made into the basket to storage.

One does not usually need to directly call this; shoop.front.middleware.ShoopFrontMiddleware will usually take care of it.

shop_ids
total_weight
class shoop.front.basket.objects.BasketLine(source=None, **kwargs)[source]

Bases: shoop.core.order_creator.source.SourceLine

add_quantity(quantity)[source]
cache_info(request)[source]
can_change_quantity
can_delete
shop_product

ShopProduct object of this line.

Return type:shoop.core.models.product_shops.ShopProduct
type
shoop.front.basket.order_creator module
class shoop.front.basket.order_creator.BasketOrderCreator(request)[source]

Bases: shoop.core.order_creator.creator.OrderCreator

shoop.front.basket.update_methods module
class shoop.front.basket.update_methods.BasketUpdateMethods(request, basket)[source]

Bases: object

delete_line(line, **kwargs)[source]
get_prefix_to_method_map()[source]

Override this method to link prefixes with their associated methods to call.

Format of the dictionary is: { FIELD_NAME_PREFIX: METHOD }.

METHOD is a function which accepts the keyword arguments given in update_basket_contents. It should perform the necessary changes to the basket_line and then return whether the value had changed or not. (See update_quantity or delete_line for examples.)

update_quantity(line, value, **kwargs)[source]
Module contents
shoop.front.basket.get_basket(request)[source]
Return type:shoop.front.basket.objects.BaseBasket
shoop.front.basket.get_basket_command_dispatcher(request)[source]
Return type:shoop.front.basket.command_dispatcher.BasketCommandDispatcher
shoop.front.basket.get_basket_order_creator(request)[source]
shoop.front.basket.get_basket_view()[source]
shoop.front.models package
Submodules
shoop.front.models.basket module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.front.models.rst, line 10)

autodoc: failed to import module ‘shoop.front.models.basket’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 385, in import_object __import__(self.modname) ImportError: No module named ‘shoop.front.models.basket’
Module contents

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.front.models.rst, line 19)

autodoc: failed to import attribute ‘StoredBasket.data’ from module ‘shoop.front.models’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: data
class shoop.front.models.StoredBasket(id, key, owner_contact, owner_user, created_on, updated_on, persistent, deleted, finished, title, data, taxless_total, taxful_total, product_count)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception StoredBasket.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

StoredBasket.get_next_by_created_on(*moreargs, **morekwargs)
StoredBasket.get_next_by_updated_on(*moreargs, **morekwargs)
StoredBasket.get_previous_by_created_on(*moreargs, **morekwargs)
StoredBasket.get_previous_by_updated_on(*moreargs, **morekwargs)
StoredBasket.objects = <django.db.models.manager.Manager object>
StoredBasket.owner_contact
StoredBasket.owner_user
StoredBasket.products
shoop.front.template_helpers package
Submodules
shoop.front.template_helpers.category module
shoop.front.template_helpers.category.get_manufacturers(context)[source]
shoop.front.template_helpers.general module
shoop.front.template_helpers.general.get_all_manufacturers(context)[source]
shoop.front.template_helpers.general.get_best_selling_products(context, n_products=12, cutoff_days=30, no_variation_children=False)[source]
shoop.front.template_helpers.general.get_newest_products(context, n_products=6)[source]
shoop.front.template_helpers.general.get_random_products(context, n_products=6)[source]
shoop.front.template_helpers.general.get_root_categories(context)[source]
shoop.front.template_helpers.product module
shoop.front.template_helpers.product.get_products_bought_with(context, product, count=5)[source]
shoop.front.template_helpers.product.get_visible_attributes(product)[source]
shoop.front.template_helpers.product.is_visible(context, product)[source]
shoop.front.template_helpers.urls module
shoop.front.template_helpers.urls.has_url(url, *args, **kwargs)[source]
shoop.front.template_helpers.urls.model_url(context, model, absolute=False)[source]
Module contents
shoop.front.templatetags package
Submodules
shoop.front.templatetags.shoop_front module
class shoop.front.templatetags.shoop_front.HelpersNamespace[source]

Bases: object

shoop.front.templatetags.shoop_front.markdown(value)[source]
shoop.front.templatetags.thumbnails module
shoop.front.templatetags.thumbnails.process_thumbnailer_options(kwargs)[source]
shoop.front.templatetags.thumbnails.thumbnail(source, alias=None, generate=True, **kwargs)[source]
shoop.front.templatetags.thumbnails.thumbnailer(source)[source]
Module contents
shoop.front.utils package
Submodules
shoop.front.utils.product_sorting module
shoop.front.utils.product_sorting.sort_products(request, products, sort)[source]
shoop.front.utils.product_statistics module
shoop.front.utils.product_statistics.get_best_selling_product_info(shop_ids, cutoff_days=30)[source]
shoop.front.utils.product_statistics.get_products_by_brand(prod, count=6, request=None, language=None)[source]
shoop.front.utils.product_statistics.get_products_by_same_categories(prod, count=6, request=None, language=None)[source]
shoop.front.utils.product_statistics.get_products_ordered_with(prod, count=20, request=None, language=None)[source]
shoop.front.utils.views module
shoop.front.utils.views.cache_product_things(request, products, language=None, attribute_identifiers=('author', ))[source]
Module contents
shoop.front.views package
Submodules
shoop.front.views.basket module
class shoop.front.views.basket.BasketView(**kwargs)[source]

Bases: django.views.generic.base.View

dispatch(request, *args, **kwargs)[source]
class shoop.front.views.basket.DefaultBasketView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

get_context_data(**kwargs)[source]
template_name = 'shoop/front/basket/default_basket.jinja'
shoop.front.views.category module
class shoop.front.views.category.CategoryView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]
get_queryset()[source]
model

alias of Category

template_name = 'shoop/front/product/category.jinja'
template_object_name = 'category'
class shoop.front.views.category.ProductListForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict([('sort', <django.forms.fields.CharField object at 0x7fde3c477908>), ('manufacturers', <django.forms.models.ModelMultipleChoiceField object at 0x7fde3c41c400>)])
declared_fields = OrderedDict([('sort', <django.forms.fields.CharField object at 0x7fde3c477908>), ('manufacturers', <django.forms.models.ModelMultipleChoiceField object at 0x7fde3c41c400>)])
media
shoop.front.views.default_basket module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.front.views.rst, line 26)

autodoc: failed to import module ‘shoop.front.views.default_basket’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 385, in import_object __import__(self.modname) ImportError: No module named ‘shoop.front.views.default_basket’
shoop.front.views.index module
class shoop.front.views.index.IndexView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

get_context_data(**kwargs)[source]
template_name = 'shoop/front/index.jinja'
shoop.front.views.order module
class shoop.front.views.order.OrderCompleteView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'order'
get_object(queryset=None)[source]
model

alias of Order

render_to_response(context, **response_kwargs)[source]
template_name = 'shoop/front/order/complete.jinja'
class shoop.front.views.order.OrderRequiresVerificationView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get(request, **kwargs)[source]
get_context_data(**kwargs)[source]
get_object(queryset=None)[source]
model

alias of Order

template_name = 'shoop/front/order/requires_verification.jinja'
shoop.front.views.payment module
class shoop.front.views.payment.ProcessPaymentView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'order'
dispatch(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]
get_object(queryset=None)[source]
model

alias of Order

shoop.front.views.payment.get_payment_urls(request, order)[source]
shoop.front.views.product module
class shoop.front.views.product.ProductDetailView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'product'
get(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]
get_queryset()[source]
model

alias of Product

template_name = 'shoop/front/product/detail.jinja'
Module contents
Submodules
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 : shoop.core.models.Shop

Currently active Shop.

Todo

Define better

request.person : shoop.core.models.Contact
PersonContact of currently logged in user or AnonymousContact if there is no logged in user.
request.customer : shoop.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 : shoop.front.basket.objects.BaseBasket
Shopping basket in use.
process_request(request)[source]
process_response(request, response)[source]
classmethod refresh_on_logout(request, **kwargs)[source]
classmethod refresh_on_user_change(request, user=None, **kwargs)[source]
shoop.front.notify_events module
class shoop.front.notify_events.OrderReceived(**variable_values)[source]

Bases: shoop.notify.base.Event

bindings = {}
identifier = 'order_received'
name = 'Order Received'
variables = {'customer_email': <shoop.notify.base.Variable object at 0x7fde3c2fcc88>, 'order': <shoop.notify.base.Variable object at 0x7fde3c2fcc18>, 'customer_phone': <shoop.notify.base.Variable object at 0x7fde3c30f940>, 'language': <shoop.notify.base.Variable object at 0x7fde3c30f160>}
shoop.front.notify_events.send_order_received_notification(order, **kwargs)[source]
shoop.front.settings module
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_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_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_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_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_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_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.signals module
shoop.front.urls module
Module contents
class shoop.front.ShoopFrontAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_front'
name = 'shoop.front'
provides = {'notify_event': ['shoop.front.notify_events:OrderReceived'], 'admin_module': ['shoop.front.admin_module.BasketAdminModule']}
ready()[source]
verbose_name = 'Shoop Frontend'
shoop.notify package
Subpackages
shoop.notify.actions package
Submodules
shoop.notify.actions.debug module
class shoop.notify.actions.debug.SetDebugFlag(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'flag_name': <shoop.notify.base.Binding object at 0x7fde3d33af98>}
execute(context)[source]
identifier = 'set_debug_flag'
name = 'Set Debug Flag'
variables = {}
shoop.notify.actions.email module
class shoop.notify.actions.email.SendEmail(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'recipient': <shoop.notify.base.Binding object at 0x7fde3d42b0b8>, 'send_identifier': <shoop.notify.base.Binding object at 0x7fde3d42bda0>, 'language': <shoop.notify.base.Binding object at 0x7fde3d42b2b0>, 'fallback_language': <shoop.notify.base.Binding object at 0x7fde3d42b5c0>}
execute(context)[source]
Parameters:context (shoop.notify.script.Context) – Script Context
identifier = 'send_email'
name = 'Send Email'
template_fields = {'subject': <django.forms.fields.CharField object at 0x7fde3d439320>, 'body': <django.forms.fields.CharField object at 0x7fde3d42ba58>}
template_use = <TemplateUse.MULTILINGUAL: 2>
variables = {}
shoop.notify.actions.notification module
class shoop.notify.actions.notification.AddNotification(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'priority': <shoop.notify.base.Binding object at 0x7fde3d516d68>, 'recipient_type': <shoop.notify.base.Binding object at 0x7fde3d42b1d0>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fde3d516a20>, 'recipient': <shoop.notify.base.Binding object at 0x7fde3d42ba90>, 'url': <shoop.notify.base.Binding object at 0x7fde3d5164a8>, 'message': <shoop.notify.base.TemplatedBinding object at 0x7fde3d516240>}
execute(context)[source]
identifier = 'add_notification'
name = 'Add Notification'
variables = {}
shoop.notify.actions.order module
class shoop.notify.actions.order.AddOrderLogEntry(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'order': <shoop.notify.base.Binding object at 0x7fde3c71f748>, 'message': <shoop.notify.base.Binding object at 0x7fde3d439b70>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fde3d439a90>}
execute(context)[source]
identifier = 'add_order_log_entry'
name = 'Add Order Log Entry'
variables = {}
Module contents
class shoop.notify.actions.AddNotification(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'priority': <shoop.notify.base.Binding object at 0x7fde3d516d68>, 'recipient_type': <shoop.notify.base.Binding object at 0x7fde3d42b1d0>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fde3d516a20>, 'recipient': <shoop.notify.base.Binding object at 0x7fde3d42ba90>, 'url': <shoop.notify.base.Binding object at 0x7fde3d5164a8>, 'message': <shoop.notify.base.TemplatedBinding object at 0x7fde3d516240>}
execute(context)[source]
identifier = 'add_notification'
name = 'Add Notification'
variables = {}
class shoop.notify.actions.AddOrderLogEntry(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'order': <shoop.notify.base.Binding object at 0x7fde3c71f748>, 'message': <shoop.notify.base.Binding object at 0x7fde3d439b70>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fde3d439a90>}
execute(context)[source]
identifier = 'add_order_log_entry'
name = 'Add Order Log Entry'
variables = {}
class shoop.notify.actions.SendEmail(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'recipient': <shoop.notify.base.Binding object at 0x7fde3d42b0b8>, 'send_identifier': <shoop.notify.base.Binding object at 0x7fde3d42bda0>, 'language': <shoop.notify.base.Binding object at 0x7fde3d42b2b0>, 'fallback_language': <shoop.notify.base.Binding object at 0x7fde3d42b5c0>}
execute(context)[source]
Parameters:context (shoop.notify.script.Context) – Script Context
identifier = 'send_email'
name = 'Send Email'
template_fields = {'subject': <django.forms.fields.CharField object at 0x7fde3d439320>, 'body': <django.forms.fields.CharField object at 0x7fde3d42ba58>}
template_use = <TemplateUse.MULTILINGUAL: 2>
variables = {}
class shoop.notify.actions.SetDebugFlag(data, validate=True)[source]

Bases: shoop.notify.base.Action

bindings = {'flag_name': <shoop.notify.base.Binding object at 0x7fde3d33af98>}
execute(context)[source]
identifier = 'set_debug_flag'
name = 'Set Debug Flag'
variables = {}
shoop.notify.admin_module package
Subpackages
shoop.notify.admin_module.views package
Submodules
shoop.notify.admin_module.views.editor module
class shoop.notify.admin_module.views.editor.EditScriptContentView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'script'
get_context_data(**kwargs)[source]
model

alias of Script

post(request, *args, **kwargs)[source]
template_name = 'notify/admin/script_content_editor.jinja'
class shoop.notify.admin_module.views.editor.EditScriptView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'script'
form_class

alias of ScriptForm

form_valid(form)[source]
get_context_data(**kwargs)[source]
model

alias of Script

template_name = 'notify/admin/edit_script.jinja'
class shoop.notify.admin_module.views.editor.ScriptAPI(request, script)[source]

Bases: object

dispatch()[source]
handle_get_data(data)[source]
handle_save_data(data)[source]
shoop.notify.admin_module.views.editor.script_item_editor(request)[source]
shoop.notify.admin_module.views.list module
class shoop.notify.admin_module.views.list.ScriptListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3d0240b8>, <shoop.admin.utils.picotable.Column object at 0x7fde3d024ba8>, <shoop.admin.utils.picotable.Column object at 0x7fde3d0247f0>]
get_event_identifier_text(instance)[source]
get_object_abstract(instance, item)[source]
get_object_url(instance)[source]
get_toolbar()[source]
model

alias of Script

Module contents
shoop.notify.admin_module.views.script_item_editor(request)[source]
class shoop.notify.admin_module.views.EditScriptView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'script'
form_class

alias of ScriptForm

form_valid(form)[source]
get_context_data(**kwargs)[source]
model

alias of Script

template_name = 'notify/admin/edit_script.jinja'
class shoop.notify.admin_module.views.EditScriptContentView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'script'
get_context_data(**kwargs)[source]
model

alias of Script

post(request, *args, **kwargs)[source]
template_name = 'notify/admin/script_content_editor.jinja'
class shoop.notify.admin_module.views.ScriptListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3d0240b8>, <shoop.admin.utils.picotable.Column object at 0x7fde3d024ba8>, <shoop.admin.utils.picotable.Column object at 0x7fde3d0247f0>]
get_event_identifier_text(instance)[source]
get_object_abstract(instance, item)[source]
get_object_url(instance)[source]
get_toolbar()[source]
model

alias of Script

Submodules
shoop.notify.admin_module.forms module
class shoop.notify.admin_module.forms.ScriptForm(**kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('event_identifier', 'name', 'enabled')
model

alias of Script

ScriptForm.base_fields = OrderedDict([('event_identifier', <django.forms.fields.ChoiceField object at 0x7fde3d42b438>), ('name', <django.forms.fields.CharField object at 0x7fde3ce12390>), ('enabled', <django.forms.fields.BooleanField object at 0x7fde3d33a5c0>)])
ScriptForm.declared_fields = OrderedDict([('event_identifier', <django.forms.fields.ChoiceField object at 0x7fde3d42b438>), ('name', <django.forms.fields.CharField object at 0x7fde3ce12390>), ('enabled', <django.forms.fields.BooleanField object at 0x7fde3d33a5c0>)])
ScriptForm.media
class shoop.notify.admin_module.forms.ScriptItemEditForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict()
declared_fields = OrderedDict()
get_initial()[source]
media
populate_form()[source]
save()[source]
shoop.notify.admin_module.utils module
shoop.notify.admin_module.utils.get_enum_choices_dict(enum_class)[source]
shoop.notify.admin_module.utils.get_name_map(category_key)[source]
Module contents
class shoop.notify.admin_module.NotifyAdminModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_notifications(request)[source]
get_urls()[source]
mark_notification_read_view(request, pk)[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.notify.conditions package
Submodules
shoop.notify.conditions.simple module
class shoop.notify.conditions.simple.BaseEqual(data, validate=True)[source]

Bases: shoop.notify.base.Condition

bindings = {}
identifier = 'base_equal'
identifier_suffix = 'equal'
name = 'Base Equal'
test(context)[source]
variables = {}
class shoop.notify.conditions.simple.CaseInsensitiveStringEqual(data, validate=True)[source]

Bases: shoop.notify.base.Condition

bindings = {}
identifier = 'case_insensitive_string_equal'
identifier_suffix = 'equal'
name = 'Case Insensitive String Equal'
test(context)[source]
variables = {}
class shoop.notify.conditions.simple.Empty(data, validate=True)[source]

Bases: shoop.notify.base.Condition

bindings = {'v': <shoop.notify.base.Binding object at 0x7fde3d3534e0>}
description = <django.utils.functional.lazy.<locals>.__proxy__ object>
identifier = 'empty'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
test(context)[source]
variables = {}
class shoop.notify.conditions.simple.NonEmpty(data, validate=True)[source]

Bases: shoop.notify.base.Condition

bindings = {'v': <shoop.notify.base.Binding object at 0x7fde3d3536a0>}
description = <django.utils.functional.lazy.<locals>.__proxy__ object>
identifier = 'non_empty'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
test(context)[source]
variables = {}
shoop.notify.conditions.simple.construct_simple(base, var_type)[source]
Module contents
class shoop.notify.conditions.BooleanEqual(data, validate=True)

Bases: shoop.notify.conditions.simple.BaseEqual

bindings = {'v1': <shoop.notify.base.Binding object at 0x7fde3d3bee80>, 'v2': <shoop.notify.base.Binding object at 0x7fde3d3becf8>}
identifier = 'boolean_equal'
name = 'Boolean Equal'
variables = {}
class shoop.notify.conditions.Empty(data, validate=True)[source]

Bases: shoop.notify.base.Condition

bindings = {'v': <shoop.notify.base.Binding object at 0x7fde3d3534e0>}
description = <django.utils.functional.lazy.<locals>.__proxy__ object>
identifier = 'empty'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
test(context)[source]
variables = {}
class shoop.notify.conditions.IntegerEqual(data, validate=True)

Bases: shoop.notify.conditions.simple.BaseEqual

bindings = {'v1': <shoop.notify.base.Binding object at 0x7fde3c5c37b8>, 'v2': <shoop.notify.base.Binding object at 0x7fde3c5c30f0>}
identifier = 'integer_equal'
name = 'Integer Equal'
variables = {}
class shoop.notify.conditions.LanguageEqual(data, validate=True)

Bases: shoop.notify.conditions.simple.CaseInsensitiveStringEqual

bindings = {'v1': <shoop.notify.base.Binding object at 0x7fde3d3536d8>, 'v2': <shoop.notify.base.Binding object at 0x7fde3d353860>}
identifier = 'language_equal'
name = 'Language Equal'
variables = {}
class shoop.notify.conditions.NonEmpty(data, validate=True)[source]

Bases: shoop.notify.base.Condition

bindings = {'v': <shoop.notify.base.Binding object at 0x7fde3d3536a0>}
description = <django.utils.functional.lazy.<locals>.__proxy__ object>
identifier = 'non_empty'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
test(context)[source]
variables = {}
class shoop.notify.conditions.TextEqual(data, validate=True)

Bases: shoop.notify.conditions.simple.CaseInsensitiveStringEqual

bindings = {'v1': <shoop.notify.base.Binding object at 0x7fde3d3532e8>, 'v2': <shoop.notify.base.Binding object at 0x7fde3d353748>}
identifier = 'text_equal'
name = 'Text Equal'
variables = {}
shoop.notify.models package
Submodules
shoop.notify.models.notification module
class shoop.notify.models.notification.Notification(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A model for persistent notifications to be shown in the admin, etc.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Notification.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Notification.data
Notification.get_next_by_created_on(*moreargs, **morekwargs)
Notification.get_previous_by_created_on(*moreargs, **morekwargs)
Notification.get_priority_display(*moreargs, **morekwargs)
Notification.get_recipient_type_display(*moreargs, **morekwargs)
Notification.is_read
Notification.mark_read(user)[source]
Notification.marked_read_by
Notification.objects = <shoop.notify.models.notification.NotificationManager object>
Notification.priority

A placeholder class that provides a way to set the attribute on the model.

Notification.recipient
Notification.recipient_type

A placeholder class that provides a way to set the attribute on the model.

Notification.save(*args, **kwargs)[source]
Notification.set_reverse_url(**reverse_kwargs)[source]
Notification.url
class shoop.notify.models.notification.NotificationManager[source]

Bases: django.db.models.manager.Manager

for_user(user)[source]
unread_for_user(user)[source]
shoop.notify.models.script module
class shoop.notify.models.script.Script(id, event_identifier, identifier, created_on, name, enabled, _step_data)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Script.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Script.event_class
Script.execute(context)[source]

Execute the script in the given context.

Parameters:context (shoop.notify.script.Context) – Script context
Script.get_next_by_created_on(*moreargs, **morekwargs)
Script.get_previous_by_created_on(*moreargs, **morekwargs)
Script.get_serialized_steps()[source]
Script.get_steps()[source]

:rtype Iterable[Step]

Script.objects = <django.db.models.manager.Manager object>
Script.set_serialized_steps(serialized_data)[source]
Script.set_steps(steps)[source]
Module contents
class shoop.notify.models.Notification(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A model for persistent notifications to be shown in the admin, etc.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Notification.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Notification.data
Notification.get_next_by_created_on(*moreargs, **morekwargs)
Notification.get_previous_by_created_on(*moreargs, **morekwargs)
Notification.get_priority_display(*moreargs, **morekwargs)
Notification.get_recipient_type_display(*moreargs, **morekwargs)
Notification.is_read
Notification.mark_read(user)[source]
Notification.marked_read_by
Notification.objects = <shoop.notify.models.notification.NotificationManager object>
Notification.priority

A placeholder class that provides a way to set the attribute on the model.

Notification.recipient
Notification.recipient_type

A placeholder class that provides a way to set the attribute on the model.

Notification.save(*args, **kwargs)[source]
Notification.set_reverse_url(**reverse_kwargs)[source]
Notification.url
class shoop.notify.models.Script(id, event_identifier, identifier, created_on, name, enabled, _step_data)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Script.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Script.event_class
Script.execute(context)[source]

Execute the script in the given context.

Parameters:context (shoop.notify.script.Context) – Script context
Script.get_next_by_created_on(*moreargs, **morekwargs)
Script.get_previous_by_created_on(*moreargs, **morekwargs)
Script.get_serialized_steps()[source]
Script.get_steps()[source]

:rtype Iterable[Step]

Script.objects = <django.db.models.manager.Manager object>
Script.set_serialized_steps(serialized_data)[source]
Script.set_steps(steps)[source]
Submodules
shoop.notify.base module
class shoop.notify.base.Action(data, validate=True)[source]

Bases: shoop.notify.base.ScriptItem

bindings = {}
execute(context)[source]
Parameters:context (shoop.notify.script.Context) – Script Context
get_template(context)[source]

Get this action’s template instance, bound in the context.

Return type:shoop.notify.template.Template
get_template_values(context, language_preferences=())[source]

Render this Action’s template with data from the given context.

Parameters:
  • context (shoop.notify.script.Context) – Script Context
  • language_preferences (list[str]) – Language preference list. The first language in the template to have values for all fields will be used. Has no effect for UNILINGUAL template_use.
Returns:

Dict of field name -> rendered template text.

Return type:

dict[str, str]|None

identifier = 'action'
name = 'Action'
provide_category = 'notify_action'
template_fields = {}
template_use = <TemplateUse.NONE: 0>
variables = {}
class shoop.notify.base.Base[source]

Bases: object

bindings = {}
classmethod class_for_identifier(identifier)[source]
description = None
identifier = None
name = None
provide_category = None
variables = {}
class shoop.notify.base.BaseMetaclass[source]

Bases: type

class shoop.notify.base.Binding(name, type=<class 'shoop.notify.typology.Type'>, required=False, help_text='', constant_use=<ConstantUse.VARIABLE_ONLY: 1>, default=None)[source]

Bases: shoop.notify.base.Variable

accepts_any_type
allow_constant
allow_variable
get_value(context, bind_data)[source]
class shoop.notify.base.Condition(data, validate=True)[source]

Bases: shoop.notify.base.ScriptItem

bindings = {}
identifier = 'condition'
name = 'Condition'
provide_category = 'notify_condition'
test(context)[source]
variables = {}
class shoop.notify.base.Event(**variable_values)[source]

Bases: shoop.notify.base.Base

bindings = {}
identifier = None
load_variables(variable_values)[source]
log_target
log_target_variable = None

The name of the variable to be used as the log target for this event.

The target variable must have an add_log_entry method.

provide_category = 'notify_event'
run()[source]
variables = {}
class shoop.notify.base.ScriptItem(data, validate=True)[source]

Bases: shoop.notify.base.Base

bindings = {}
classmethod get_ui_info_map()[source]
get_value(context, binding_name)[source]

Get the actual value of a binding from the given script context.

Parameters:
Returns:

The variable value

get_values(context)[source]

Get all binding values in a dict.

Parameters:context (shoop.notify.script.Context) – Script Context
Returns:Dict of binding name -> value
Return type:dict[name, value]
identifier = 'script_item'
name = 'Script Item'
provide_category = None
serialize()[source]
classmethod unserialize(data, validate=True)[source]
variables = {}
verify_bindings()[source]
class shoop.notify.base.TemplatedBinding(*args, **kwargs)[source]

Bases: shoop.notify.base.Binding

get_value(context, bind_data)[source]
class shoop.notify.base.Variable(name, type=<class 'shoop.notify.typology.Type'>, required=True, help_text='')[source]

Bases: object

get_matching_types(variable_dict)[source]
shoop.notify.enums module
class shoop.notify.enums.ConstantUse[source]

Bases: enumfields.enums.Enum

class shoop.notify.enums.Priority[source]

Bases: enumfields.enums.Enum

class shoop.notify.enums.RecipientType[source]

Bases: enumfields.enums.Enum

class shoop.notify.enums.StepConditionOperator[source]

Bases: enumfields.enums.Enum

class shoop.notify.enums.StepNext[source]

Bases: enumfields.enums.Enum

class shoop.notify.enums.TemplateUse[source]

Bases: enumfields.enums.Enum

shoop.notify.runner module
shoop.notify.runner.run_event(event)[source]
shoop.notify.script module
class shoop.notify.script.Context(variables=None)[source]

Bases: object

add_log_entry_on_log_target(message, identifier, **kwargs)[source]

Add a log entry on the context’s log target.

The kwargs are passed to the target’s add_log_entry method.

If no log target exists or if it has no add_log_entry method, this method does nothing.

Parameters:
  • message (str) – The message text.
  • identifier (str) – The message identifier. Unlike with add_log_entry, this is required.
  • kwargs (dict) – Other kwargs to pass to add_log_entry
classmethod from_event(event)[source]

Create Context from event.

Return type:shoop.notify.script.Context
classmethod from_variables(**variables)[source]

Create Context from variables.

Return type:shoop.notify.script.Context
get(name, default=None)[source]
get_variables()[source]
log(level, msg, *args, **kwargs)[source]

Log a message with the context’s logger (not the log target). This may be an useful debugging tool.

The parameters are the same as for logging.Logger.log().

log_entry_queryset
set(name, value)[source]
class shoop.notify.script.Step(conditions=(), actions=(), next=<StepNext.CONTINUE: 'continue'>, cond_op=<StepConditionOperator.ALL: 'all'>, enabled=True)[source]

Bases: object

enabled
execute(context)[source]
serialize()[source]
classmethod unserialize(step_data)[source]
shoop.notify.script.none(conditions)[source]
shoop.notify.settings module
shoop.notify.template module
exception shoop.notify.template.NoLanguageMatches[source]

Bases: Exception

class shoop.notify.template.Template(context, data)[source]

Bases: object

has_language(language, fields)[source]
render(language, fields)[source]

Render this template in the given language, returning the given fields.

Parameters:
  • language (str) – Language code (ISO 639-1 or ISO 639-2)
  • fields (list[str]) – Desired fields to render.
Returns:

Dict of field -> rendered content.

Return type:

dict[str, str]

render_first_match(language_preferences, fields)[source]
shoop.notify.template.render_in_context(context, template_text, html_intent=False)[source]

Render the given Jinja2 template text in the script context.

Parameters:
  • context (shoop.notify.script.Context) – Script context.
  • template_text (str) – Jinja2 template text.
  • html_intent (bool) – Is the template text intended for HTML output? This currently turns on autoescaping.
Returns:

Rendered template text

Return type:

str

Raises:

Whatever Jinja2 might happen to raise

shoop.notify.typology module
class shoop.notify.typology.Boolean[source]

Bases: shoop.notify.typology.Type

identifier = 'boolean'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.notify.typology.Decimal[source]

Bases: shoop.notify.typology._Number

get_field(**kwargs)[source]
identifier = 'decimal'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.notify.typology.Email[source]

Bases: shoop.notify.typology._String

get_field(**kwargs)[source]
identifier = 'email'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.notify.typology.Enum(enum_class)[source]

Bases: shoop.notify.typology.Type

enum_class = None
get_field(**kwargs)[source]
identifier = 'enum'
name
unserialize(value)[source]
class shoop.notify.typology.Integer[source]

Bases: shoop.notify.typology._Number

get_field(**kwargs)[source]
identifier = 'integer'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.notify.typology.Language[source]

Bases: shoop.notify.typology._String

identifier = 'language'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.notify.typology.Model(model_label)[source]

Bases: shoop.notify.typology.Type

get_field(**kwargs)[source]
get_model()[source]
Return type:django.db.models.Model
identifier = 'model'
is_coercible_from(other_type)[source]
model_label = None
name
unserialize(value)[source]
class shoop.notify.typology.Phone[source]

Bases: shoop.notify.typology._String

identifier = 'phone'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.notify.typology.Text[source]

Bases: shoop.notify.typology._String

identifier = 'text'
is_coercible_from(other_type)[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
class shoop.notify.typology.Type[source]

Bases: object

get_field(**kwargs)[source]

Get a Django form field for this type.

The kwargs are passed directly to the field constructor.

Parameters:kwargs (dict) – Kwargs for field constructor
Returns:Form field
Return type:django.forms.Field
identifier = None
is_coercible_from(other_type)[source]
name = None
unserialize(value)[source]
validate(value)[source]
class shoop.notify.typology.URL[source]

Bases: shoop.notify.typology._String

get_field(**kwargs)[source]
identifier = 'url'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
Module contents
class shoop.notify.Action(data, validate=True)[source]

Bases: shoop.notify.base.ScriptItem

bindings = {}
execute(context)[source]
Parameters:context (shoop.notify.script.Context) – Script Context
get_template(context)[source]

Get this action’s template instance, bound in the context.

Return type:shoop.notify.template.Template
get_template_values(context, language_preferences=())[source]

Render this Action’s template with data from the given context.

Parameters:
  • context (shoop.notify.script.Context) – Script Context
  • language_preferences (list[str]) – Language preference list. The first language in the template to have values for all fields will be used. Has no effect for UNILINGUAL template_use.
Returns:

Dict of field name -> rendered template text.

Return type:

dict[str, str]|None

identifier = 'action'
name = 'Action'
provide_category = 'notify_action'
template_fields = {}
template_use = <TemplateUse.NONE: 0>
variables = {}
class shoop.notify.Binding(name, type=<class 'shoop.notify.typology.Type'>, required=False, help_text='', constant_use=<ConstantUse.VARIABLE_ONLY: 1>, default=None)[source]

Bases: shoop.notify.base.Variable

accepts_any_type
allow_constant
allow_variable
get_value(context, bind_data)[source]
class shoop.notify.Context(variables=None)[source]

Bases: object

add_log_entry_on_log_target(message, identifier, **kwargs)[source]

Add a log entry on the context’s log target.

The kwargs are passed to the target’s add_log_entry method.

If no log target exists or if it has no add_log_entry method, this method does nothing.

Parameters:
  • message (str) – The message text.
  • identifier (str) – The message identifier. Unlike with add_log_entry, this is required.
  • kwargs (dict) – Other kwargs to pass to add_log_entry
classmethod from_event(event)[source]

Create Context from event.

Return type:shoop.notify.script.Context
classmethod from_variables(**variables)[source]

Create Context from variables.

Return type:shoop.notify.script.Context
get(name, default=None)[source]
get_variables()[source]
log(level, msg, *args, **kwargs)[source]

Log a message with the context’s logger (not the log target). This may be an useful debugging tool.

The parameters are the same as for logging.Logger.log().

log_entry_queryset
set(name, value)[source]
class shoop.notify.Condition(data, validate=True)[source]

Bases: shoop.notify.base.ScriptItem

bindings = {}
identifier = 'condition'
name = 'Condition'
provide_category = 'notify_condition'
test(context)[source]
variables = {}
class shoop.notify.ConstantUse[source]

Bases: enumfields.enums.Enum

class shoop.notify.Event(**variable_values)[source]

Bases: shoop.notify.base.Base

bindings = {}
identifier = None
load_variables(variable_values)[source]
log_target
log_target_variable = None
provide_category = 'notify_event'
run()[source]
variables = {}
class shoop.notify.TemplateUse[source]

Bases: enumfields.enums.Enum

class shoop.notify.Variable(name, type=<class 'shoop.notify.typology.Type'>, required=True, help_text='')[source]

Bases: object

get_matching_types(variable_dict)[source]
shoop.simple_cms package
Subpackages
shoop.simple_cms.admin_module package
Submodules
shoop.simple_cms.admin_module.views module
class shoop.simple_cms.admin_module.views.PageEditView(**kwargs)[source]

Bases: shoop.admin.utils.views.CreateOrUpdateView

context_object_name = 'page'
form_class

alias of PageForm

form_invalid(form)[source]
form_valid(form)[source]
model

alias of Page

template_name = 'shoop/simple_cms/admin/edit.jinja'
class shoop.simple_cms.admin_module.views.PageForm(**kwargs)[source]

Bases: shoop.utils.multilanguage_model_form.MultiLanguageModelForm

class Meta[source]

Bases: object

fields = ['title', 'url', 'content', 'available_from', 'available_to', 'identifier', 'visible_in_menu']
model

alias of Page

PageForm.base_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7fde3c15ad30>), ('url', <django.forms.fields.CharField object at 0x7fde3c15ada0>), ('content', <django.forms.fields.CharField object at 0x7fde3c15a2b0>), ('available_from', <django.forms.fields.DateTimeField object at 0x7fde3da51e48>), ('available_to', <django.forms.fields.DateTimeField object at 0x7fde3c15a780>), ('identifier', <django.forms.fields.CharField object at 0x7fde3e6665c0>), ('visible_in_menu', <django.forms.fields.BooleanField object at 0x7fde3e666908>)])
PageForm.clean()[source]

If title or content has been given on any language we must enforce that the other fields are also required in that language.

This is done the way it is because url is not required by default in model level.

PageForm.declared_fields = OrderedDict([('available_from', <django.forms.fields.DateTimeField object at 0x7fde3da51e48>), ('available_to', <django.forms.fields.DateTimeField object at 0x7fde3c15a780>), ('title', <django.forms.fields.CharField object at 0x7fde3c15ad30>), ('url', <django.forms.fields.CharField object at 0x7fde3c15ada0>), ('content', <django.forms.fields.CharField object at 0x7fde3c15a2b0>)])
PageForm.media
class shoop.simple_cms.admin_module.views.PageListView(**kwargs)[source]

Bases: shoop.admin.utils.views.PicotableListView

columns = [<shoop.admin.utils.picotable.Column object at 0x7fde3c15a550>, <shoop.admin.utils.picotable.Column object at 0x7fde3c15a518>, <shoop.admin.utils.picotable.Column object at 0x7fde3d323828>, <shoop.admin.utils.picotable.Column object at 0x7fde3d323f60>, <shoop.admin.utils.picotable.Column object at 0x7fde3d323cf8>]
get_object_abstract(instance, item)[source]
model

alias of Page

Module contents
class shoop.simple_cms.admin_module.SimpleCMSAdminModule[source]

Bases: shoop.admin.base.AdminModule

breadcrumbs_menu_entry = <shoop.admin.base.MenuEntry object>
get_menu_category_icons()[source]
get_menu_entries(request)[source]
get_model_url(object, kind)[source]
get_urls()[source]
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
Submodules
shoop.simple_cms.models module
class shoop.simple_cms.models.Page(id, available_from, available_to, created_by, modified_by, created_on, modified_on, identifier, visible_in_menu)[source]

Bases: parler.models.TranslatableModel

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Page.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Page.content

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Page.created_by
Page.get_html()[source]
Page.get_next_by_created_on(*moreargs, **morekwargs)
Page.get_next_by_modified_on(*moreargs, **morekwargs)
Page.get_previous_by_created_on(*moreargs, **morekwargs)
Page.get_previous_by_modified_on(*moreargs, **morekwargs)
Page.is_visible(dt=None)[source]
Page.modified_by
Page.objects = <django.db.models.manager.ManagerFromPageQuerySet object>
Page.title

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

Page.translations
Page.url

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

class shoop.simple_cms.models.PageQuerySet(*args, **kwargs)[source]

Bases: parler.managers.TranslatableQuerySet

visible(dt=None)[source]

Get pages that should be publicly visible.

This does not do permission checking.

Parameters:dt (datetime.datetime) – Datetime for visibility check
Returns:QuerySet of pages.
Return type:QuerySet[Page]
class shoop.simple_cms.models.PageTranslation(id, language_code, title, url, content, master)

Bases: parler.models.TranslatedFieldsModel

exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shoop.simple_cms.models.DoesNotExist, shoop.simple_cms.models.DoesNotExist

exception PageTranslation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PageTranslation.get_language_code_display(*moreargs, **morekwargs)
PageTranslation.master
PageTranslation.objects = <django.db.models.manager.Manager object>
shoop.simple_cms.template_helpers module
class shoop.simple_cms.template_helpers.SimpleCMSTemplateHelpers[source]

Bases: object

get_page_by_identifier(identifier)[source]
get_visible_pages()[source]
name = 'simple_cms'
shoop.simple_cms.urls module
shoop.simple_cms.views module
class shoop.simple_cms.views.PageView(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

context_object_name = 'page'
get(request, *args, **kwargs)[source]

Override normal get method to return correct page based on the active language and slug

Cases:
  1. Page is not found: raise Http404() like django would

  2. No translation in active language for the page: raise Http404()

  3. Translation was found for active language, but the url doesn’t match given url:

    return HttpResponseRedirect to the active languages url

  4. If none of the upper matches: render page normally

get_queryset()[source]
model

alias of Page

slug_field = 'translations__url'
slug_url_kwarg = 'url'
template_name = 'shoop/simple_cms/page.jinja'
Module contents
class shoop.simple_cms.AppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_simple_cms'
name = 'shoop.simple_cms'
provides = {'front_urls_post': ['shoop.simple_cms.urls:urlpatterns'], 'admin_module': ['shoop.simple_cms.admin_module:SimpleCMSAdminModule'], 'front_template_helper_namespace': ['shoop.simple_cms.template_helpers:SimpleCMSTemplateHelpers']}
verbose_name = <django.utils.functional.lazy.<locals>.__proxy__ object>
shoop.simple_pricing package
Submodules
shoop.simple_pricing.admin_form_part module
class shoop.simple_pricing.admin_form_part.SimplePricingForm(**kwargs)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict()
declared_fields = OrderedDict()
get_shop_group_field(shop, group)[source]
media
save()[source]
class shoop.simple_pricing.admin_form_part.SimplePricingFormPart(request, object=None)[source]

Bases: shoop.admin.form_part.FormPart

form_valid(form)[source]
get_form_defs()[source]
priority = 10
shoop.simple_pricing.models module
class shoop.simple_pricing.models.SimpleProductPrice(id, product, shop, group, price, includes_tax)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception SimpleProductPrice.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

SimpleProductPrice.group
SimpleProductPrice.objects = <django.db.models.manager.Manager object>
SimpleProductPrice.product
SimpleProductPrice.shop
shoop.simple_pricing.module module
class shoop.simple_pricing.module.SimplePricingContext(**kwargs)[source]

Bases: shoop.core.pricing.PricingContext

REQUIRED_VALUES = ('customer_group_ids', 'shop_id')
customer_group_ids = ()
shop_id = None
class shoop.simple_pricing.module.SimplePricingModule[source]

Bases: shoop.core.pricing.PricingModule

get_base_price(product)[source]
get_context_from_request(request)[source]
get_price(context, product_id, quantity=1)[source]
identifier = 'simple_pricing'
name = <django.utils.functional.lazy.<locals>.__proxy__ object>
pricing_context_class

alias of SimplePricingContext

shoop.simple_pricing.settings module
shoop.simple_pricing.settings.SHOOP_SIMPLE_PRICING_TAXFUL_DECIMALS = 2

TODO: Document SHOOP_SIMPLE_PRICING_TAXFUL_DECIMALS

shoop.simple_pricing.utils module
Module contents
class shoop.simple_pricing.ShoopSimplePricingAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'simple_pricing'
name = 'shoop.simple_pricing'
provides = {'api_populator': ['shoop.simple_pricing.api:populate_simple_pricing_api'], 'pricing_module': ['shoop.simple_pricing.module:SimplePricingModule'], 'admin_product_form_part': ['shoop.simple_pricing.admin_form_part:SimplePricingFormPart']}
verbose_name = 'Shoop Simple Pricing'
shoop.simple_supplier package
Submodules
shoop.simple_supplier.models module
class shoop.simple_supplier.models.StockAdjustment(id, product, supplier, created_on, created_by, delta)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception StockAdjustment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

StockAdjustment.created_by
StockAdjustment.get_next_by_created_on(*moreargs, **morekwargs)
StockAdjustment.get_previous_by_created_on(*moreargs, **morekwargs)
StockAdjustment.objects = <django.db.models.manager.Manager object>
StockAdjustment.product
StockAdjustment.supplier
class shoop.simple_supplier.models.StockCount(id, product, supplier, logical_count, physical_count)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception StockCount.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

StockCount.objects = <django.db.models.manager.Manager object>
StockCount.product
StockCount.supplier
shoop.simple_supplier.module module
class shoop.simple_supplier.module.SimpleSupplierModule(supplier, options)[source]

Bases: shoop.core.suppliers.base.BaseSupplierModule

adjust_stock(product_id, delta, created_by=None)[source]
get_stock_statuses(product_ids)[source]
identifier = 'simple_supplier'
name = 'Simple Supplier'
update_stock(product_id)[source]
shoop.simple_supplier.utils module
shoop.simple_supplier.utils.get_current_stock_value(supplier_id, product_id)[source]
Module contents
class shoop.simple_supplier.ShoopSimpleSupplierAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'simple_supplier'
name = 'shoop.simple_supplier'
provides = {'supplier_module': ['shoop.simple_supplier.module:SimpleSupplierModule']}
verbose_name = 'Shoop Simple Supplier'
shoop.testing package
Subpackages
shoop.testing.admin_module package
Submodules
shoop.testing.admin_module.mocker_view module
class shoop.testing.admin_module.mocker_view.MockerForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict([('type', <django.forms.fields.ChoiceField object at 0x7fde3bd79438>), ('count', <django.forms.fields.IntegerField object at 0x7fde3bd794e0>)])
declared_fields = OrderedDict([('type', <django.forms.fields.ChoiceField object at 0x7fde3bd79438>), ('count', <django.forms.fields.IntegerField object at 0x7fde3bd794e0>)])
media
class shoop.testing.admin_module.mocker_view.MockerView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

form_class

alias of MockerForm

form_valid(form)[source]
get_form(form_class=None)
get_mockers()[source]
mockers = <shoop.testing.admin_module.mocker_view.Mockers object>
template_name = 'shoop_testing/mocker.jinja'
class shoop.testing.admin_module.mocker_view.Mockers[source]

Bases: object

Namespace object for mocker methods.

The docstrings for the callables are user-visible.

mock_company()[source]

Create a random company

mock_order()[source]

Create a random order

mock_person()[source]

Create a random person

Module contents
class shoop.testing.admin_module.TestingAdminModule[source]

Bases: shoop.admin.base.AdminModule

get_menu_entries(request)[source]
get_urls()[source]
shoop.testing.management package
Subpackages
shoop.testing.management.commands package
Submodules
shoop.testing.management.commands.shoop_populate_mock module
class shoop.testing.management.commands.shoop_populate_mock.Command(stdout=None, stderr=None, no_color=False)[source]

Bases: django.core.management.base.BaseCommand

handle(*args, **options)[source]
option_list = (<Option at 0x7fde3bcff320: --with-superuser>,)
Module contents
Module contents
Submodules
shoop.testing.factories module
class shoop.testing.factories.CategoryFactory[source]

Bases: factory.django.DjangoModelFactory

identifier = <factory.declarations.Sequence object>
name = <factory.fuzzy.FuzzyText object>
post = <factory.declarations.PostGeneration object>
status = <factory.fuzzy.FuzzyChoice object>
class shoop.testing.factories.CompanyFactory[source]

Bases: factory.django.DjangoModelFactory

email = <factory.declarations.Sequence object>
name = <factory.fuzzy.FuzzyText object>
vat_id = <factory.fuzzy.FuzzyText object>
class shoop.testing.factories.FuzzyBoolean(probability, **kwargs)[source]

Bases: factory.fuzzy.BaseFuzzyAttribute

fuzz()[source]
class shoop.testing.factories.FuzzyName(prefix='', length=12, suffix='', chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', **kwargs)[source]

Bases: factory.fuzzy.FuzzyText

fuzz()[source]
class shoop.testing.factories.ProductFactory[source]

Bases: factory.django.DjangoModelFactory

cost_center = <factory.fuzzy.FuzzyInteger object>
name = <shoop.testing.factories.FuzzyName object>
post = <factory.declarations.PostGeneration object>
profit_center = <factory.fuzzy.FuzzyInteger object>
sales_unit = <factory.declarations.LazyAttribute object>
sku = <factory.fuzzy.FuzzyText object>
tax_class = <factory.declarations.LazyAttribute object>
type = <factory.declarations.LazyAttribute object>
class shoop.testing.factories.ProductTypeFactory[source]

Bases: factory.django.DjangoModelFactory

identifier = <factory.declarations.Sequence object>
name = <factory.fuzzy.FuzzyText object>
class shoop.testing.factories.SalesUnitFactory[source]

Bases: factory.django.DjangoModelFactory

name = <factory.fuzzy.FuzzyText object>
short_name = <factory.fuzzy.FuzzyText object>
class shoop.testing.factories.ShopFactory[source]

Bases: factory.django.DjangoModelFactory

name = <factory.fuzzy.FuzzyText object>
owner = <factory.declarations.SubFactory object>
slug = <factory.fuzzy.FuzzyText object>
class shoop.testing.factories.ShopProductFactory[source]

Bases: factory.django.DjangoModelFactory

listed = <shoop.testing.factories.FuzzyBoolean object>
purchasable = <shoop.testing.factories.FuzzyBoolean object>
searchable = <shoop.testing.factories.FuzzyBoolean object>
visible = <shoop.testing.factories.FuzzyBoolean object>
class shoop.testing.factories.UserFactory[source]

Bases: factory.django.DjangoModelFactory

email = <factory.declarations.Sequence object>
first_name = <factory.fuzzy.FuzzyText object>
last_name = <factory.fuzzy.FuzzyText object>
password = <factory.declarations.PostGenerationMethodCall object>
username = <factory.declarations.Sequence object>
shoop.testing.factories.create_default_tax_rule(tax)[source]
shoop.testing.factories.create_empty_order()[source]
shoop.testing.factories.create_order_with_product(product, supplier, quantity, taxless_unit_price, tax_rate=0, n_lines=1)[source]
shoop.testing.factories.create_product(sku, shop=None, supplier=None)[source]
shoop.testing.factories.create_random_address(fake=None, **values)[source]
shoop.testing.factories.create_random_company()[source]
shoop.testing.factories.create_random_order(customer=None, products=(), completion_probability=0)[source]
shoop.testing.factories.create_random_person(locale=None)[source]
shoop.testing.factories.default_by_identifier(model)[source]
shoop.testing.factories.get_address(**overrides)[source]
shoop.testing.factories.get_completed_order_status()[source]
shoop.testing.factories.get_default_attribute_set()[source]
shoop.testing.factories.get_default_category()[source]
shoop.testing.factories.get_default_customer_group()[source]
shoop.testing.factories.get_default_payment_method()[source]
shoop.testing.factories.get_default_product()[source]
shoop.testing.factories.get_default_product_type()[source]
shoop.testing.factories.get_default_sales_unit()[source]
shoop.testing.factories.get_default_shipping_method()[source]
shoop.testing.factories.get_default_shop()[source]
shoop.testing.factories.get_default_shop_product()[source]
shoop.testing.factories.get_default_supplier()[source]
shoop.testing.factories.get_default_tax()[source]
shoop.testing.factories.get_default_tax_class()[source]
shoop.testing.factories.get_faker(providers, locale=None)[source]
shoop.testing.factories.get_initial_order_status()[source]
shoop.testing.factories.get_random_filer_image()[source]
shoop.testing.factories.get_tax(code, name, rate=None, amount=None)[source]
shoop.testing.factories.get_test_tax(rate)[source]
shoop.testing.image_generator module
class shoop.testing.image_generator.BaseImageGenerator(image, palette, seed)[source]

Bases: object

draw_circle(x, y, w, h, color)[source]
draw_rectangle(x, y, w, h, color)[source]
generate()[source]
class shoop.testing.image_generator.ModernArtImageGenerator(image, palette, seed)[source]

Bases: shoop.testing.image_generator.BaseImageGenerator

generate()[source]
class shoop.testing.image_generator.RandomImageGenerator(image, palette, seed)[source]

Bases: shoop.testing.image_generator.BaseImageGenerator

generate()[source]
step()[source]
class shoop.testing.image_generator.RingImageGenerator(image, palette, seed)[source]

Bases: shoop.testing.image_generator.BaseImageGenerator

generate()[source]
shoop.testing.image_generator.generate_image(width, height, palette=None, seed=None, supersample=2)[source]
shoop.testing.mock_population module
class shoop.testing.mock_population.Populator[source]

Bases: object

generate_pricing(product)[source]
populate()[source]
populate_if_required()[source]
shoop.testing.mock_population.populate_if_required()[source]
shoop.testing.pseudo_payment module
class shoop.testing.pseudo_payment.ExampleDetailViewClass(**kwargs)[source]

Bases: django.views.generic.base.View

dispatch(request, *args, **kwargs)[source]
class shoop.testing.pseudo_payment.PseudoPaymentMethodModule(method, options)[source]

Bases: shoop.core.methods.base.BasePaymentMethodModule

admin_detail_view_class

alias of ExampleDetailViewClass

compute_pseudo_mac(order)[source]
get_payment_process_response(order, urls)[source]
identifier = 'pseudo_payment'
name = 'Shoop Pseudo Payment'
option_fields = [('price', <django.forms.fields.DecimalField object at 0x7fde3da46b38>), ('price_waiver_product_minimum', <django.forms.fields.DecimalField object at 0x7fde3da46588>), ('bg_color', <django.forms.fields.CharField object at 0x7fde3bf62390>), ('fg_color', <django.forms.fields.CharField object at 0x7fde3bf62128>)]
process_payment_return_request(order, request)[source]
shoop.testing.soup_utils module
shoop.testing.soup_utils.extract_form_fields(soup)[source]

Turn a BeautifulSoup form in to a dict of fields and default values

shoop.testing.text_data module
shoop.testing.text_data.random_title(second_adj_chance=0.3, prefix='', suffix='')[source]
Module contents
class shoop.testing.ShoopTestingAppConfig(*args, **kwargs)[source]

Bases: shoop.apps.AppConfig

label = 'shoop_testing'
name = 'shoop.testing'
provides = {'admin_module': ['shoop.testing.admin_module:TestingAdminModule'], 'payment_method_module': ['shoop.testing.pseudo_payment:PseudoPaymentMethodModule']}
verbose_name = 'Shoop Testing & Demo Utilities'
shoop.utils package
Submodules
shoop.utils.analog module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.utils.rst, line 10)

autodoc: failed to import attribute ‘BaseLogEntry.extra’ from module ‘shoop.utils.analog’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 109, in safe_getattr return getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/jsonfield-1.0.3-py3.4.egg/jsonfield/subclassing.py”, line 33, in __get__ raise AttributeError(‘Can only be accessed via an instance.’) AttributeError: Can only be accessed via an instance. During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 392, in import_object obj = self.get_attr(obj, part) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 288, in get_attr return safe_getattr(obj, name, *defargs) File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/util/inspect.py”, line 115, in safe_getattr raise AttributeError(name) AttributeError: extra
class shoop.utils.analog.BaseLogEntry(*args, **kwargs)[source]

Bases: django.db.models.base.Model

class Meta[source]

Bases: object

abstract = False
BaseLogEntry.get_kind_display(*moreargs, **morekwargs)
BaseLogEntry.get_next_by_created_on(*moreargs, **morekwargs)
BaseLogEntry.get_previous_by_created_on(*moreargs, **morekwargs)
BaseLogEntry.kind

A placeholder class that provides a way to set the attribute on the model.

BaseLogEntry.target = None
BaseLogEntry.user
class shoop.utils.analog.LogEntryKind[source]

Bases: enumfields.enums.Enum

shoop.utils.analog.define_log_model(model_class)[source]
shoop.utils.dates module
shoop.utils.dates.parse_date(value)[source]

Tries to make a date out of the value. If impossible, it raises an exception.

Parameters:value – A value of some ilk.
Returns:Date
Return type:datetime.date
Raises ValueError:
 
shoop.utils.dates.parse_time(value)[source]

Tries to make a time out of the value. If impossible, it raises an exception.

Parameters:value – A value of some ilk.
Returns:Time
Return type:datetime.time
Raises ValueError:
 
shoop.utils.dates.try_parse_date(value)[source]

Tries to make a time out of the value. If impossible, returns None.

Parameters:value – A value of some ilk.
Returns:Date
Return type:datetime.date
shoop.utils.dates.try_parse_time(value)[source]

Tries to make a time out of the value. If impossible, returns None.

Parameters:value – A value of some ilk.
Returns:Time
Return type:datetime.time
shoop.utils.excs module
exception shoop.utils.excs.ExceptionalResponse(response)[source]

Bases: Exception

exception shoop.utils.excs.Problem(message, title=None)[source]

Bases: Exception

User-visible exception

message

Append a link to this Problem and return itself.

This API is designed after Exception.with_traceback(), so you can fluently chain this in a raise statement:

>>> raise Problem("Oops").with_link("...", "...")
Parameters:
  • url (str) – URL string
  • title (str) – Title text
Returns:

This same Problem

Return type:

shoop.utils.excs.Problem

shoop.utils.fields module
class shoop.utils.fields.RelaxedModelChoiceField(queryset, empty_label='---------', cache_choices=None, required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, *args, **kwargs)[source]

Bases: django.forms.models.ModelChoiceField

to_python(value)[source]
shoop.utils.filer module
shoop.utils.filer.filer_file_from_upload(request, path, upload_data, sha1=None)[source]

Create a filer.models.filemodels.File from an upload (UploadedFile or such). If the sha1 parameter is passed and a file with said SHA1 is found, it will be returned instead.

Parameters:
  • request (django.http.request.HttpRequest|None) – Request, to figure out the owner for this file
  • path (basestring|filer.models.Folder) – Pathname string (see filer_folder_from_path) or a Filer Folder.
  • upload_data (django.core.files.base.File) – Upload data
  • sha1 (basestring) – SHA1 checksum. If given and a matching model with the SHA1 is found, it is returned instead.
Return type:

filer.models.filemodels.File

shoop.utils.filer.filer_folder_from_path(path)[source]

Split path by slashes and create a hierarchy of Filer Folder objects accordingly. Blank path components are ignored, so “/////foo//////bar///” is the same as “foo/bar” :param path: Pathname. :return: Folder.

shoop.utils.filer.filer_image_from_data(request, path, file_name, file_data, sha1=None)[source]

Create a Filer Image from the given data string. If the sha1 parameter is passed and True (the value True, not a truey value), the SHA-1 of the data string is calculated and passed to the underlying creation function. If the sha1 parameter is truthy (generally the SHA-1 hex string), it’s passed directly to the creation function.

Parameters:
  • request (django.http.request.HttpRequest|None) – Request, to figure out the owner for this file
  • path (basestring|filer.models.Folder) – Pathname string (see filer_folder_from_path) or a Filer Folder.
  • file_name – File name
  • file_data (bytes) – Upload data
  • sha1 (basestring|bool) – SHA-1 checksum of the data, if available, to do deduplication. May also be True to calculate the SHA-1 first.
Return type:

filer.models.imagemodels.Image

shoop.utils.filer.filer_image_from_upload(request, path, upload_data, sha1=None)[source]

Create a Filer Image from an upload (UploadedFile or such). If the sha1 parameter is passed and an Image with said SHA1 is found, it will be returned instead.

Parameters:
  • request (django.http.request.HttpRequest|None) – Request, to figure out the owner for this file
  • path (basestring|filer.models.Folder) – Pathname string (see filer_folder_from_path) or a Filer Folder.
  • upload_data (django.core.files.base.File) – Upload data
  • sha1 (basestring) – SHA-1 checksum of the data, if available, to do deduplication
Return type:

filer.models.imagemodels.Image

shoop.utils.form_group module
class shoop.utils.form_group.FormDef(name, form_class, required=True, kwargs=None)[source]

Bases: object

instantiate(prefix, group_initial=None, **extra_kwargs)[source]
class shoop.utils.form_group.FormGroup(data=None, files=None, auto_id='id_%s', prefix=None, initial=None)[source]

Bases: object

add_form_def(name, form_class, required=True, kwargs=None)[source]
errors

Returns an ErrorDict for the data provided for the form

forms
full_clean()[source]
instantiate_forms()[source]
is_valid()[source]
shoop.utils.forms module
shoop.utils.forms.fill_model_instance(instance, data)[source]

Fill whatever fields possible in instance using the data dict. :param instance: :param data:

shoop.utils.forms.get_effective_form_data(form)[source]

Return ‘effective’ data for the form, in essence running its validation methods, but trying to return its state to what it was before the full_clean. Not fool- proof, but what in this universe is.

Returns:data dict
shoop.utils.forms.merged_initial_and_data(form)[source]
shoop.utils.i18n module
shoop.utils.i18n.format_home_currency(value, locale=None)[source]
shoop.utils.i18n.get_babel_locale(locale_string)[source]

Parse a Django-format (dash-separated) locale string and return a Babel locale.

This function is decorated with lru_cache, so executions should be cheap even if babel.Locale.parse() most definitely is not.

Parameters:locale_string (str) – A locale string (“en-US”, “fi-FI”, “fi”)
Returns:Babel Locale
Return type:babel.Locale
shoop.utils.i18n.get_current_babel_locale()[source]

Get a Babel locale based on the thread’s locale context.

Returns:Babel Locale
Return type:babel.Locale
shoop.utils.i18n.get_language_name(language_code)[source]
shoop.utils.importing module
shoop.utils.importing.cached_load(setting_name, default_value=None)[source]
shoop.utils.importing.clear_load_cache()[source]
shoop.utils.importing.load(specification, context_explanation='Load')[source]
shoop.utils.iterables module
shoop.utils.iterables.first(iterable, default=None)[source]
shoop.utils.models module
shoop.utils.models.copy_model_instance(obj)[source]
shoop.utils.models.get_data_dict(obj)[source]
shoop.utils.multilanguage_model_form module
class shoop.utils.multilanguage_model_form.MultiLanguageModelForm(**kwargs)[source]

Bases: parler.forms.TranslatableModelForm

base_fields = OrderedDict()
declared_fields = OrderedDict()
media
pre_master_save(instance)[source]
save(commit=True)[source]
shoop.utils.multilanguage_model_form.to_language_codes(languages)[source]
shoop.utils.numbers module
class shoop.utils.numbers.UnitedDecimal[source]

Bases: decimal.Decimal

Decimal with unit.

Allows creating decimal classes that cannot be mixed, e.g. to prevent operations like

>>> TaxfulPrice(1) + TaxlessPrice(2)

where TaxfulPrice and TaxlessPrice are subclasses of UnitedDecimal.

copy_negate(*args, **kwargs)[source]
quantize(exp, *args, **kwargs)[source]
shoop.utils.numbers.bankers_round(value, ndigits=0)[source]
shoop.utils.numbers.strip_non_float_chars(s)[source]

Strips characters that aren’t part of normal floats.

shoop.utils.numbers.parse_decimal_string(s)[source]

Parse decimals with “best effort”.

Parses a string (or unicode) that may be embellished with spaces and other weirdness into the most probable Decimal.

Parameters:s (str) – Input value
Returns:Decimal
Return type:Decimal
shoop.utils.numbers.try_parse_decimal_string(s)[source]
shoop.utils.numbers.get_string_sort_order(s)[source]

Return a sorting order value for a string that contains a garment size.

Parameters:s (str) – Input value (string or number)
Returns:Sorting tuple
Return type:tuple
shoop.utils.objects module
shoop.utils.objects.compact(in_obj, none_only=True, deep=True)[source]

Compact an iterable (either a mapping or a list) by removing falsy values, or if none_only is set, by removing `None`s.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/shoop-1.1.0-py3.4.egg/shoop/utils/objects.py:docstring of shoop.utils.objects.compact, line 1); backlink

Inline interpreted text or phrase reference start-string without end-string.

By default, iterables within the iterable are also compacted.

Parameters:
  • in_obj (Iterable) – The object to compact
  • none_only (bool) – Remove only Nones
  • deep (bool) – Recurse through iterables within in_obj
Returns:

Flattened iterable

Return type:

list|dict

shoop.utils.objects.compare_partial_dicts(source, comparee)[source]

Compare dicts in a “partial” manner. All key/value pairs in source must exist and be equal to those in comparee.

This differs from a raw == in that keys that do not exist in source may exist in comparee.

Parameters:
  • source (dict) – source dict
  • comparee (dict) – comparee dict
Return type:

bool

Returns:

True or False

shoop.utils.objects.extract_inner_value(source, attr_chain)[source]

Search for a stored value by recursing through dict keys and attributes. Erroneous/missing keys/attribute names will return None.

Parameters:
  • source – The original object, that either has attributes or is itself a dict.
  • attr_chain (tuple) – A tuple of properly ordered strings, containing the attributes and/or keys to successively obtain.
>>> mydict = {"foo": {"bar": {"thing": 25}}}
>>> extract_inner_value(mydict, ("foo", "bar", "thing"))
25
>>> extract_inner_value(mydict, ("foo", "bar", "unthing"))
>>> bool(extract_inner_value(mydict, ("__getitem__",)))
True
>>> bool(extract_inner_value(mydict, ("__getotem__",)))
False
shoop.utils.settings_doc module
shoop.utils.settings_doc.get_known_settings_documentation(order_by='app', only_changed=False)[source]
shoop.utils.settings_doc.get_known_settings_with_comments()[source]
shoop.utils.setup module
class shoop.utils.setup.Setup(load_from=None)[source]

Bases: object

commit(source)[source]
classmethod configure(configure)[source]
get(key, default=None)[source]
getlist(key, default=())[source]
is_valid_key(key)[source]
values()[source]
shoop.utils.text module
shoop.utils.text.camel_case(value)[source]

CamelCase the given value (join capitalized words). No other treatment is done; use identifierify for that.

shoop.utils.text.flatten(str, whitespace='-')[source]

Flatten the given text into lowercase ASCII, removing diacriticals etc. Replace runs of whitespace with the given whitespace replacement.

>>> flatten(u"hellö, wörld")
"hello,-world"
Parameters:
  • str (str) – The string to massage
  • whitespace (str) – The string to replace whitespace with
Returns:

A flattened string

Return type:

str

shoop.utils.text.identifierify(value, sep='_')[source]

Identifierify the given text (keep only alphanumerics and the given separator(s).

Parameters:
  • value (str) – The text to identifierify
  • sep (str) – The separator(s) to keep
Returns:

An identifierified string

Return type:

str

shoop.utils.text.kebab_case(value)[source]

Kebab-case the given value (join words with dashes). No other treatment is done; use identifierify for that.

shoop.utils.text.snake_case(value)[source]

Snake_case the given value (join words with underscores). No other treatment is done; use identifierify for that.

shoop.utils.text.space_case(value)[source]

Space case the given value (join words that may have been otherwise separated with spaces). No other treatment is done; use identifierify for that.

shoop.utils.translation module
shoop.utils.translation.cache_translations(objects, languages=None)[source]

Cache translation objects in given languages to the objects in one fell swoop. This will iterate a queryset, if one is passed! :param objects: List or queryset of Translatable models :param languages: Iterable of languages to fetch. In addition, all “_current_language”s will be fetched :return: objects

Module contents
Submodules
shoop.version module

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shoop/checkouts/v1.1.0/doc/api/shoop.rst, line 26)

autodoc: failed to import module ‘shoop.version’; the following exception was raised: Traceback (most recent call last): File “/home/docs/checkouts/readthedocs.org/user_builds/shoop/envs/v1.1.0/lib/python3.4/site-packages/sphinx/ext/autodoc.py”, line 385, in import_object __import__(self.modname) ImportError: No module named ‘shoop.version’
Module contents

Shoop Web APIs

REST API

The Shoop REST API is built on Django REST Framework with additional functionality built on <provides> to auto-discover available viewsets.

Setting up the Shoop REST API

First, add rest_framework and shoop.api to your INSTALLED_APPS.

Then – and this differs from Django REST Framework’s defaults – you must add the REST_FRAMEWORK configuration dict to your settings. Django REST Framework defaults to no permission checking whatsoever (rest_framework.permissions.AllowAny), which would make all of your data world-readable and writable.

This is not what we want to accidentally happen, so configuration is enforced.

For the sake of demonstration, let’s make the API only accessible for superusers with the IsAdminUser permission policy. (Authentication is enabled by the default settings.)

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',)
}

Now just add the API to your root urlconf.

urlpatterns = patterns(
    # *snip*
    url(r'^api/', include('shoop.api.urls')),
    # *snip*
)

All done! If you visit the /api/ URL (as a suitably authenticated user), you should be presented with Django REST Framework’s human-friendly user interface.

REST API Usage Example

This sketch of a script illustrates how to use the Shoop REST API.

# -*- coding: utf-8 -*-
import json
import uuid
import requests

base_url = "http://127.0.0.1:8000/api/"
s = requests.session()
s.auth = ("admin", "admin")

def send(endpoint, data, method="post"):
    data = json.dumps(data)
    resp = s.request(method, base_url + endpoint, data=data, headers={
        "Content-Type": "application/json",
        "Accept": "application/json;indent=4",
        "X-Requested-With": "XMLHttpRequest"  # For `request.is_ajax()`
    })
    if resp.status_code > 300:
        raise Exception(resp.text)
    return resp.json()


def create_product():
    product = send("shoop/product/", {
        "tax_class": 1,
        "sku": str(uuid.uuid4()),
        "type": 1,
        "translations": {
            "en": {
                "name": "Hello"
            }
        }
    })
    return product


def create_shop_product(product):
    product_id = product["id"]

    shop_product = send("shoop/shop_product/", {
        "product": product_id,
        "shop": 1,
    })
    assert not shop_product.get("primary_category")

    shop_product = send("shoop/shop_product/%d/" % shop_product["id"], {
        "primary_category": 1,
        "purchase_multiple": 38
    }, "patch")
    assert shop_product.get("primary_category") == 1
    return shop_product


def create_product_price(product):
    price = send("shoop/simple_product_price/", {
        "product": product["id"],
        "shop": None,
        "group": None,
        "price": 180
    })
    return price


def main():
    product = create_product()
    shop_product = create_shop_product(product)
    price = create_product_price(product)
    print(product["id"])


if __name__ == "__main__":
    main()

Indices and tables