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
.
Set up a new virtualenv for your Shoop project.
Grab a Git clone of the Shoop sources. For this guide, we’ll assume the checkout of the clone lives in
/stuff/shoop
.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.
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.
Setup a virtualenv and activate it. You may use the traditional
virtualenv
command, or the newerpython -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/activateFinally, 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`_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 byshoop.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 byshoop.core.models.ShippingMethod
. supplier_module
- Supplier module classes (deriving from
shoop.core.suppliers.base.BaseSupplierModule
), as used byshoop.core.models.Supplier
. tax_module
- Tax module classes; the tax module in use is set with the
SHOOP_TAX_MODULE
setting. xtheme
- XTheme themes (full theme sets).
xtheme_plugin
- XTheme plugins (that are placed into placeholders within themes).
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 frontend theme up and running. If not, you can start by reading Getting Started guide.
Shoop’s default frontend theme¶
Shoop’s frontend templates are written with Jinja2 which is a templating engine for Python very similar to Django’s templates.
The default frontend theme uses 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 frontend and the default theme 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 frontend theme can be found in shoop/front/apps/default_theme/
.
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 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 the default frontend theme all
the included filenames start with
_
. All navigation related HTML and template tags are included tobase.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.
Simple Search¶
Simple Search is its own application that can be found in the front apps folder:
shoop/apps/simple_search/templates
- Search
shoop/simple_search/search.jinja
- The search template includes the search form, search result sorting options and a list of search results.
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¶
You may either derive your own theme from the default theme, or write your own from scratch.
The basic principle of deriving custom Shoop templates is not to modify the
original files (default frontend themes) within the app directory, but to copy them
into to your own application’s template directory.
If your own application is listed before shoop.front
(and/or other theme apps)
in Django’s INSTALLED_APPS
configuration, Django will prefer your templates
over others with the same path.
This means it is possible to overwrite only some of the default files or all of them. If there is no customized template with the same path and filename, Django will use the default 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 frontend 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¶
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¶
-
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
-
type
= 'normal'¶
-
-
class
shoop.admin.dashboard.blocks.
DashboardMoneyBlock
(id, value, title, currency, **kwargs)[source]¶
-
class
shoop.admin.dashboard.blocks.
DashboardValueBlock
(id, value, title, **kwargs)[source]¶ Bases:
shoop.admin.dashboard.blocks.DashboardBlock
-
default_size
= 'small'¶
-
type
= 'value'¶
-
-
class
shoop.admin.dashboard.charts.
Chart
(title)[source]¶ Bases:
object
-
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
-
type
= 'normal'¶
-
-
class
shoop.admin.dashboard.
DashboardValueBlock
(id, value, title, **kwargs)[source]¶ Bases:
shoop.admin.dashboard.blocks.DashboardBlock
-
default_size
= 'small'¶
-
type
= 'value'¶
-
-
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', 'image', '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 0x7fa5cb3f4748>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7fa5cb2f00f0>), ('status', <enumfields.forms.EnumChoiceField object at 0x7fa5cb2f03c8>), ('ordering', <django.forms.fields.IntegerField object at 0x7fa5cb2f0668>), ('visibility', <enumfields.forms.EnumChoiceField object at 0x7fa5cb2f0710>), ('visibility_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7fa5cb2f07b8>), ('name', <django.forms.fields.CharField object at 0x7fa5cb2eb080>), ('image', <filer.fields.image.AdminImageFormField object at 0x7fa5cb2f0470>), ('description', <django.forms.fields.CharField object at 0x7fa5cb2dfeb8>), ('slug', <django.forms.fields.SlugField object at 0x7fa5cb2dfd68>)])¶
-
CategoryBaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7fa5cb2eb080>), ('description', <django.forms.fields.CharField object at 0x7fa5cb2dfeb8>), ('slug', <django.forms.fields.SlugField object at 0x7fa5cb2dfd68>)])¶
-
CategoryBaseForm.
media
¶
-
class
-
class
shoop.admin.modules.categories.views.edit.
CategoryBaseFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
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'¶
-
model
¶ alias of
Category
-
template_name
= 'shoop/admin/categories/edit.jinja'¶
-
-
class
shoop.admin.modules.categories.views.list.
CategoryListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5cb2f0ac8>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2f0b70>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2f0c18>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2f0c88>]¶
-
model
¶ alias of
Category
-
-
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'¶
-
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 0x7fa5cb2f0ac8>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2f0b70>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2f0c18>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2f0c88>]¶
-
model
¶ alias of
Category
-
-
class
shoop.admin.modules.contacts.views.detail.
ContactDetailToolbar
(contact)[source]¶ Bases:
shoop.admin.toolbar.Toolbar
-
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 0x7fa5cbc87c50>), ('name', <django.forms.fields.CharField object at 0x7fa5cbfc1898>), ('suffix', <django.forms.fields.CharField object at 0x7fa5cbe35cc0>), ('name_ext', <django.forms.fields.CharField object at 0x7fa5cbe35ba8>), ('phone', <django.forms.fields.CharField object at 0x7fa5cbe35a20>), ('email', <django.forms.fields.EmailField object at 0x7fa5cbe35668>), ('street', <django.forms.fields.CharField object at 0x7fa5cbe35a90>), ('street2', <django.forms.fields.CharField object at 0x7fa5cbe353c8>), ('street3', <django.forms.fields.CharField object at 0x7fa5cbe35f60>), ('postal_code', <django.forms.fields.CharField object at 0x7fa5cbe35b00>), ('city', <django.forms.fields.CharField object at 0x7fa5cbe35390>), ('region_code', <django.forms.fields.CharField object at 0x7fa5cbf4b048>), ('region', <django.forms.fields.CharField object at 0x7fa5cbf4b1d0>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7fa5cbd8b8d0>)])¶
-
AddressForm.
declared_fields
= OrderedDict()¶
-
AddressForm.
media
¶
-
class
-
class
shoop.admin.modules.contacts.views.edit.
ContactAddressesFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
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
= {'Contact': ('is_active', 'language', 'marketing_permission', 'phone', 'www', 'timezone', 'prefix', 'name', 'suffix', 'name_ext', 'email', 'tax_group'), 'CompanyContact': ('tax_number',), 'PersonContact': ('gender', 'birth_date')}¶
-
-
class
shoop.admin.modules.contacts.views.edit.
ContactBaseFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
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'¶
-
model
¶ alias of
Contact
-
template_name
= 'shoop/admin/contacts/edit.jinja'¶
-
-
class
shoop.admin.modules.contacts.views.list.
ContactListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5cbe89390>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe713c8>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe71358>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe71438>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe715c0>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe71588>]¶
-
model
¶ alias of
Contact
-
-
class
shoop.admin.modules.contacts.views.
ContactListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5cbe89390>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe713c8>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe71358>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe71438>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe715c0>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe71588>]¶
-
model
¶ alias of
Contact
-
-
class
shoop.admin.modules.contacts.views.
ContactDetailView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
context_object_name
= 'contact'¶
-
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
-
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'¶
-
model
¶ alias of
Contact
-
template_name
= 'shoop/admin/contacts/edit.jinja'¶
-
-
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
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
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.
-
template_name
= 'shoop/admin/media/browser.jinja'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.orders.views.list.
OrderListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5cb22fc50>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb22fe10>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb22fba8>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb22fc18>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb251358>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2a8080>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2a87f0>]¶
-
model
¶ alias of
Order
-
-
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
-
get_form
(form_class=None)¶
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_shipment.jinja'¶
-
-
class
shoop.admin.modules.orders.views.
OrderDetailView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
context_object_name
= 'order'¶
-
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 0x7fa5cb22fc50>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb22fe10>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb22fba8>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb22fc18>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb251358>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2a8080>, <shoop.admin.utils.picotable.Column object at 0x7fa5cb2a87f0>]¶
-
model
¶ alias of
Order
-
-
class
shoop.admin.modules.orders.dashboard.
OrderValueChartDashboardBlock
(id, currency, **kwargs)[source]¶
-
class
shoop.admin.modules.orders.
OrderModule
(currency=None, *args, **kwargs)[source]¶ Bases:
shoop.admin.currencybound.CurrencyBound
,shoop.admin.base.AdminModule
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.products.views.edit.
BaseProductMediaFormPart
(request, object=None)[source]¶
-
class
shoop.admin.modules.products.views.edit.
ProductAttributeFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= -800¶
-
-
class
shoop.admin.modules.products.views.edit.
ProductBaseFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
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'>, <class 'shoop.admin.modules.products.views.edit.ProductImageMediaFormPart'>, <class 'shoop.admin.modules.products.views.edit.ProductMediaFormPart'>]¶
-
context_object_name
= 'product'¶
-
form_part_class_provide_key
= 'admin_product_form_part'¶
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/edit.jinja'¶
-
-
class
shoop.admin.modules.products.views.edit.
ProductImageMediaFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.modules.products.views.edit.BaseProductMediaFormPart
-
formset
¶ alias of
ProductImageMediaFormSet
-
name
= 'images'¶
-
priority
= -600¶
-
-
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
-
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 0x7fa5caa9fb70>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7fa5caa9fd30>), ('file', <filer.fields.file.AdminFileFormField object at 0x7fa5caa9fdd8>), ('external_url', <django.forms.fields.URLField object at 0x7fa5caa9ff98>), ('ordering', <django.forms.fields.IntegerField object at 0x7fa5caa630f0>), ('enabled', <django.forms.fields.BooleanField object at 0x7fa5caa63160>), ('public', <django.forms.fields.BooleanField object at 0x7fa5caa63240>), ('purchased', <django.forms.fields.BooleanField object at 0x7fa5caa63320>), ('title', <django.forms.fields.CharField object at 0x7fa5caa9f9b0>), ('description', <django.forms.fields.CharField object at 0x7fa5caa9fac8>)])¶
-
ProductMediaForm.
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7fa5caa9f9b0>), ('description', <django.forms.fields.CharField object at 0x7fa5caa9fac8>)])¶
-
ProductMediaForm.
media
¶
-
class
-
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¶
-
max_num
= 1000¶
-
min_num
= 0¶
-
model
¶ alias of
ProductMedia
-
validate_max
= False¶
-
validate_min
= False¶
-
-
class
shoop.admin.modules.products.views.list.
ProductListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5caa63860>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa69668>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa696d8>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa69780>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa697f0>]¶
-
model
¶ alias of
Product
-
-
class
shoop.admin.modules.products.views.
ProductCrossSellEditView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
-
context_object_name
= 'product'¶
-
form_class
¶ alias of
ProductCrossSellFormSet
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/edit_cross_sell.jinja'¶
-
-
class
shoop.admin.modules.products.views.
ProductDeleteView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
context_object_name
= 'product'¶
-
model
¶ alias of
Product
-
-
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'>, <class 'shoop.admin.modules.products.views.edit.ProductImageMediaFormPart'>, <class 'shoop.admin.modules.products.views.edit.ProductMediaFormPart'>]¶
-
context_object_name
= 'product'¶
-
form_part_class_provide_key
= 'admin_product_form_part'¶
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/edit.jinja'¶
-
-
class
shoop.admin.modules.products.views.
ProductListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5caa63860>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa69668>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa696d8>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa69780>, <shoop.admin.utils.picotable.Column object at 0x7fa5caa697f0>]¶
-
model
¶ alias of
Product
-
-
class
shoop.admin.modules.products.views.
ProductVariationView
(**kwargs)[source]¶ Bases:
shoop.admin.form_part.FormPartsViewMixin
,django.views.generic.edit.UpdateView
-
context_object_name
= 'product'¶
-
form_class
¶ alias of
Form
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/variation/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
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/edit_media.jinja'¶
-
-
class
shoop.admin.modules.taxes.views.edit.
CustomerTaxGroupEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
-
context_object_name
= 'customer_tax_group'¶
-
form_class
¶ alias of
CustomerTaxGroupForm
-
model
¶ alias of
CustomerTaxGroup
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:customer_tax_group.list'¶
-
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
-
CustomerTaxGroupForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7fa5ca75ac18>)])¶
-
CustomerTaxGroupForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7fa5ca75ac18>)])¶
-
CustomerTaxGroupForm.
media
¶
-
-
class
shoop.admin.modules.taxes.views.edit.
TaxClassEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
-
context_object_name
= 'tax_class'¶
-
form_class
¶ alias of
TaxClassForm
-
model
¶ alias of
TaxClass
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:tax_class.list'¶
-
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
-
TaxClassForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7fa5ca761860>), ('enabled', <django.forms.fields.BooleanField object at 0x7fa5ca761b00>)])¶
-
TaxClassForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7fa5ca761860>)])¶
-
TaxClassForm.
media
¶
-
-
class
shoop.admin.modules.taxes.views.edit.
TaxEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
-
add_form_errors_as_messages
= True¶
-
context_object_name
= 'tax'¶
-
model
¶ alias of
Tax
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:tax.list'¶
-
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', 'code', 'rate', 'amount_value', 'currency', 'enabled']¶
-
model
¶ alias of
Tax
-
-
TaxForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7fa5ca761780>), ('code', <django.forms.fields.CharField object at 0x7fa5ca761898>), ('rate', <shoop.admin.forms.fields.PercentageField object at 0x7fa5ca761400>), ('amount_value', <django.forms.fields.DecimalField object at 0x7fa5ca75aef0>), ('currency', <django.forms.fields.CharField object at 0x7fa5ca75ae10>), ('enabled', <django.forms.fields.BooleanField object at 0x7fa5ca75acf8>)])¶
-
TaxForm.
declared_fields
= OrderedDict([('rate', <shoop.admin.forms.fields.PercentageField object at 0x7fa5ca761400>), ('name', <django.forms.fields.CharField object at 0x7fa5ca761780>)])¶
-
TaxForm.
media
¶
-
class
-
class
shoop.admin.modules.taxes.views.list.
CustomerTaxGroupListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5ca768080>]¶
-
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 0x7fa5ca768160>]¶
-
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 0x7fa5ca761e10>, <shoop.admin.utils.picotable.Column object at 0x7fa5ca761e80>, <shoop.admin.utils.picotable.Column object at 0x7fa5ca761ef0>, <shoop.admin.utils.picotable.Column object at 0x7fa5ca761f60>]¶
-
model
¶ alias of
Tax
-
-
class
shoop.admin.modules.taxes.views.
TaxClassListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5ca768160>]¶
-
model
¶ alias of
TaxClass
-
-
class
shoop.admin.modules.taxes.views.
TaxClassEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
-
context_object_name
= 'tax_class'¶
-
form_class
¶ alias of
TaxClassForm
-
model
¶ alias of
TaxClass
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:tax_class.list'¶
-
template_name
= 'shoop/admin/taxes/edit_tax_class.jinja'¶
-
-
class
shoop.admin.modules.taxes.views.
TaxEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
-
add_form_errors_as_messages
= True¶
-
context_object_name
= 'tax'¶
-
form_class
¶ alias of
TaxForm
-
model
¶ alias of
Tax
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:tax.list'¶
-
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 0x7fa5ca761e10>, <shoop.admin.utils.picotable.Column object at 0x7fa5ca761e80>, <shoop.admin.utils.picotable.Column object at 0x7fa5ca761ef0>, <shoop.admin.utils.picotable.Column object at 0x7fa5ca761f60>]¶
-
model
¶ alias of
Tax
-
-
class
shoop.admin.modules.taxes.views.
CustomerTaxGroupEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
-
context_object_name
= 'customer_tax_group'¶
-
form_class
¶ alias of
CustomerTaxGroupForm
-
model
¶ alias of
CustomerTaxGroup
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:customer_tax_group.list'¶
-
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 0x7fa5ca768080>]¶
-
model
¶ alias of
CustomerTaxGroup
-
-
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 0x7fa5cbe2bda0>), ('permission_info', <django.forms.fields.CharField object at 0x7fa5cbe2ba58>)])¶
-
declared_fields
= OrderedDict([('password', <django.forms.fields.CharField object at 0x7fa5cbe2bda0>), ('permission_info', <django.forms.fields.CharField object at 0x7fa5cbe2ba58>)])¶
-
media
¶
-
-
class
shoop.admin.modules.users.views.detail.
UserDetailToolbar
(view)[source]¶ Bases:
shoop.admin.toolbar.Toolbar
-
class
shoop.admin.modules.users.views.list.
UserListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5cbe2be10>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2b9b0>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2b160>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2b208>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2bef0>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2bf98>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2bf28>]¶
-
model
= 'auth.User'¶
-
-
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 0x7fa5cbe2bd30>), ('password1', <django.forms.fields.CharField object at 0x7fa5cbfc1860>), ('password2', <django.forms.fields.CharField object at 0x7fa5cbfc1c18>)])¶
-
declared_fields
= OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7fa5cbe2bd30>), ('password1', <django.forms.fields.CharField object at 0x7fa5cbfc1860>), ('password2', <django.forms.fields.CharField object at 0x7fa5cbfc1c18>)])¶
-
error_messages
= {'password_mismatch': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fa5cbe2b978>, 'password_incorrect': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fa5cbe2b048>}¶
-
media
¶
-
-
class
shoop.admin.modules.users.views.password.
UserChangePasswordView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
-
form_class
¶ alias of
PasswordChangeForm
-
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.permissions.
PermissionChangeFormBase
(changing_user, *args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
base_fields
= OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7fa5cbfc1358>)])¶
-
declared_fields
= OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7fa5cbfc1358>)])¶
-
media
¶
-
-
class
shoop.admin.modules.users.views.
UserListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5cbe2be10>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2b9b0>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2b160>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2b208>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2bef0>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2bf98>, <shoop.admin.utils.picotable.Column object at 0x7fa5cbe2bf28>]¶
-
model
= 'auth.User'¶
-
-
class
shoop.admin.modules.users.views.
UserDetailView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
-
context_object_name
= 'user'¶
-
fields
= ('username', 'email', 'first_name', 'last_name')¶
-
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
-
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
-
model
= 'auth.User'¶
-
template_name
= 'shoop/admin/users/reset_password.jinja'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
This module is installed as the shoop_admin template function namespace.
-
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:
-
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: - request (django.http.HttpRequest) – Request to messagify
- form (django.forms.Form) – The errorful form.
Returns: Number of messages added. May be thousands, for a very unlucky form.
Return type:
-
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.
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.
-
class
shoop.admin.utils.picotable.
ChoicesFilter
(choices=None, filter_field=None)[source]¶ Bases:
shoop.admin.utils.picotable.Filter
-
type
= 'choices'¶
-
-
class
shoop.admin.utils.picotable.
Picotable
(request, columns, queryset, context)[source]¶ Bases:
object
-
class
shoop.admin.utils.picotable.
PicotableViewMixin
[source]¶ Bases:
object
-
columns
= []¶
-
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]
-
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
-
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
-
type
= 'text'¶
-
-
class
shoop.admin.utils.urls.
AdminRegexURLPattern
(regex, callback, default_args=None, name=None, require_authentication=True, permissions=())[source]¶ Bases:
django.core.urlresolvers.RegexURLPattern
-
callback
¶
-
-
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_edit_and_list_urls
(url_prefix, view_template, name_template)[source]¶ Get a list of edit/new/list URLs for (presumably) an object type with standardized URLs and names.
Parameters: Returns: List of URLs
Return type: list[AdminRegexURLPattern]
-
shoop.admin.utils.urls.
get_model_front_url
(request, object)[source]¶ Get a frontend URL for an object.
Parameters: - request (HttpRequest) – Request
- object (django.db.models.Model) – A model instance
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:
-
class
shoop.admin.utils.views.
CreateOrUpdateView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
-
add_form_errors_as_messages
= False¶
-
-
class
shoop.admin.utils.views.
PicotableListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.picotable.PicotableViewMixin
,django.views.generic.list.ListView
-
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:
-
class
shoop.admin.base.
Activity
(datetime, text, url=None)[source]¶ Bases:
shoop.admin.base.Resolvable
-
class
shoop.admin.base.
AdminModule
[source]¶ Bases:
object
-
get_activity
(request, cutoff)[source]¶ Parameters: - cutoff (datetime.datetime) – Cutoff datetime
- request (django.http.request.HttpRequest) – Request
Returns: list[shoop.admin.base.Activity]
Return type: dict[str,str]
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
-
name
= 'Base'¶
-
-
class
shoop.admin.base.
MenuEntry
(text, url, icon=None, category=None, aliases=())[source]¶ Bases:
shoop.admin.base.Resolvable
-
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
-
class
shoop.admin.form_part.
FormPartsViewMixin
[source]¶ Bases:
object
-
base_form_part_classes
= ()¶
-
fields
= ()¶
-
form_part_class_provide_key
= None¶
-
request
= None¶
-
-
class
shoop.admin.form_part.
SaveFormPartsMixin
[source]¶ Bases:
object
-
object
= None¶
-
request
= None¶
-
-
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
-
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',)¶
-
-
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')¶
-
-
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
= ()¶
-
-
class
shoop.admin.toolbar.
DropdownHeader
(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default')[source]¶ Bases:
shoop.admin.toolbar.BaseActionButton
Header for DropdownActionButtons.
-
base_css_classes
= ()¶
-
-
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
= ()¶
-
-
class
shoop.admin.toolbar.
JavaScriptActionButton
(onclick, **kwargs)[source]¶ Bases:
shoop.admin.toolbar.BaseActionButton
An action button that uses onclick for action dispatch.
-
class
shoop.admin.toolbar.
NewActionButton
(url, **kwargs)[source]¶ Bases:
shoop.admin.toolbar.URLActionButton
An URL button with sane “new” visual semantics
-
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.
-
class
shoop.admin.toolbar.
URLActionButton
(url, **kwargs)[source]¶ Bases:
shoop.admin.toolbar.BaseActionButton
An action button that renders as a link leading to url.
-
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:
-
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.sales_units:SalesUnitModule', 'shoop.admin.modules.shops:ShopModule', 'shoop.admin.modules.demo:DemoModule', 'shoop.admin.modules.manufacturers:ManufacturerModule', 'shoop.admin.modules.suppliers:SupplierModule']}¶
-
required_installed_apps
= ['bootstrap3']¶
-
verbose_name
= 'Shoop Admin'¶
-
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.
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.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:
Every Shoop Application should define an app config class derived from
shoop.apps.AppConfig
.
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
.
Applications in Shoop Base distribution should use the following rules for naming their settings.
- Each setting should be prefixed with the string SHOOP_
- 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.
- 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.
- 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.
- 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 theprovides
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.
-
-
class
shoop.core.fields.
InternalIdentifierField
(**kwargs)[source]¶ Bases:
django.db.models.fields.CharField
-
class
shoop.core.fields.
LanguageField
(*args, **kwargs)[source]¶ Bases:
django.db.models.fields.CharField
-
LANGUAGE_CODES
= {'mr', 'und', 'en', 'nso', 'xog', 'bug', 'da', 'av', 'vo', 'he', 'ig', 'awa', 'mno', 'kab', 'sai', 'gaa', 'ast', 'en_CA', 'got', 'tpi', 'ibb', 'ru', 'cy', 'bh', 'teo', 'oj', 'sg', 'nym', 'nah', 'fr_CH', 'zh', 'mkh', 'et', 'sel', 'mer', 'yo', 'znd', 'am', 'alg', 'goh', 'ira', 'pl', 'sma', 'lez', 'io', 'fat', 'ga', 'th', 'del', 'ms', 'ses', 'sad', 'dzg', 'yue', 'pap', 'kaa', 'dar', 'zap', 'bua', 'phi', 'mai', 'ach', 'bem', 'bez', 'bas', 'frm', 'ota', 'pal', 'eu', 'tai', 'ady', 'grc', 'de_CH', 'an', 'ace', 'btk', 'dje', 'new', 'kbl', 'ky', 'dsb', 'ii', 'sq', 'ts', 'ebu', 'bla', 'pt_PT', 'kha', 'ug', 'pt_BR', 'ale', 'arn', 'suk', 'za', 'nnh', 'es', 'egy', 'fro', 'kbd', 'vot', 'bin', 'nr', 'brx', 'sbp', 'twq', 'bbj', 'den', 'mul', 'sux', 'sr', 'inh', 'fiu', 'kut', 'ty', 'myv', 'ath', 'aus', 'ln', 'jv', 'jbo', 'gwi', 'lag', 'kmb', 'ay', 'chr', 'kn', 'rap', 'tyv', 'oc', 'bho', 'maf', 'cmc', 'paa', 'ss', 'so', 'na', 'gv', 'nog', 'seh', 'mh', 'lam', 'dyo', 'gon', 'cau', 'tup', 'nd', 'tem', 'mn', 'smi', 'jgo', 'ypk', 'sba', 'khi', 'uk', 'jpr', 'pi', 'bs', 'sah', 'ber', 'hup', 'gba', 'sas', 'smn', 'sog', 'kln', 'zza', 'ada', 'crp', 'bad', 'fil', 'sw', 'ang', 'aa', 'zh_Hans', 'art', 'byv', 'akk', 'zu', 'sm', 'fur', 'ar', 'ia', 'mfe', 'cpf', 'kac', 'sms', 'ain', 'ksb', 'chp', 'cai', 'fr', 'nyo', 'mua', 'nic', 'cs', 'kw', 'see', 'wak', 'tkl', 'af', 'mg', 'mas', 'bum', 'cpe', 'kaw', 'sh', 'son', 'ceb', 'hit', 'nyn', 'nai', 'de_AT', 'afa', 'cv', 'es_ES', 'ee', 'en_AU', 'sio', 'sit', 'bn', 'csb', 'cgg', 'li', 'it', 'sgn', 'hz', 'vun', 'az', 'sem', 'hmn', 'uga', 'my', 'ksf', 'kok', 'fr_CA', 'tg', 'arp', 'ar_001', 'non', 'lkt', 'kar', 'cr', 'tiv', 'lus', 'loz', 'pro', 'cu', 'rom', 'dv', 'bnt', 'kam', 'hy', 'arw', 'eka', 'pam', 'mdf', 'ch', 'nds', 'lt', 'ca', 'lg', 'gu', 'lu', 'ssy', 'root', 'frr', 'co', 'br', 'su', 'snk', 'phn', 'gor', 'ssa', 'sk', 'mwl', 'fo', 'efi', 'la', 'sus', 'kru', 'khq', 'lv', 'swc', 'oto', 'gsw', 'gl', 'nzi', 'zen', 'bkm', 'sal', 'man', 'iro', 'pra', 'tr', 'afh', 'as', 'no', 'pt', 'nia', 'sla', 'mi', 'gn', 'kcg', 'lol', 'mad', 'tn', 'ti', 'kho', 'mk', 'chm', 'fa', 'nn', 'si', 'bg', 'shu', 'tmh', 'pau', 'dz', 'was', 'nmg', 'ks', 'shn', 'mde', 'ban', 'sn', 'ybb', 'rn', 'zbl', 'ml', 'kde', 'dua', 'bax', 'fj', 'srr', 'tog', 'ur', 'fy', 'umb', 'rm', 'ta', 'enm', 'syc', 'cop', 'tig', 'luy', 'ff', 'zun', 'ro', 'chk', 'udm', 'agq', 'ne', 'nl_BE', 'wen', 'smj', 'nl', 'nqo', 'hi', 'myn', 'mgh', 'map', 'luo', 'lui', 'sv', 'de', 'dgr', 'yav', 'asa', 'cus', 'sga', 'ko', 'or', 'ja', 'hsb', 'kfo', 'is', 'sa', 'mis', 'se', 'srn', 'wo', 'ksh', 'mnc', 'tzm', 'vai', 'nap', 'mt', 'gez', 'yao', 'hai', 'sam', 'kaj', 'kk', 'ewo', 'rw', 'bal', 'sd', 'shi', 'id', 'bat', 'chb', 'cpp', 'frs', 'qu', 'tk', 'kl', 'nb', 'pag', 'roa', 'en_GB', 'be', 'tsi', 'ku', 'guz', 'tt', 'cel', 'to', 'alt', 'ny', 'tw', 'sc', 'cad', 'tet', 'kro', 'syr', 'kos', 'nv', 'mus', 'sid', 'rof', 'gem', 'pon', 'ng', 'tum', 'mwr', 'min', 'dum', 'chy', 'ha', 'fi', 'cch', 'ps', 'men', 'bik', 'moh', 'sl', 'bm', 'os', 'hu', 'ik', 'eo', 'chg', 'byn', 'bi', 'kj', 'ka', 'dak', 'zxx', 'es_419', 'wa', 'nus', 'yi', 'iba', 'grb', 'gd', 'krl', 'arc', 'sat', 'bss', 'war', 'dra', 'fan', 'bo', 'scn', 'uz', 'anp', 'haw', 'jrb', 'mag', 'rup', 'vi', 'iu', 'raj', 'gmh', 'lad', 'xal', 'fon', 'hil', 'cay', 'kkj', 'bej', 'elx', 'mun', 'din', 'ak', 'peo', 'en_US', 'rar', 'xh', 'ki', 'ie', 'zh_Hant', 'kr', 'mic', 'te', 'lb', 'om', 'tlh', 'car', 'mgo', 'tl', 'gil', 'bfd', 'cho', 've', 'el', 'ba', 'niu', 'crh', 'kv', 'mga', 'dav', 'jmc', 'bra', 'hr', 'swb', 'nwc', 'st', 'pa', 'ce', 'rwk', 'lah', 'bai', 'lo', 'ho', 'km', 'tut', 'osa', 'dyu', 'mo', 'naq', 'ijo', 'tvl', 'kpe', 'wal', 'inc', 'him', 'gay', 'doi', 'lun', 'kea', 'yap', 'apa', 'ilo', 'krc', 'ae', 'day', 'mye', 'kg', 'lua', 'mak', 'sco', 'trv', 'ckb', 'ter', 'tli', 'wae', 'ht', 'saq', 'mdr', 'mos', 'kum', 'mni', 'ine', 'chn', 'ab', 'nub'}¶
-
-
class
shoop.core.fields.
MeasurementField
(unit, **kwargs)[source]¶ Bases:
django.db.models.fields.DecimalField
-
KNOWN_UNITS
= ('mm', 'm', 'kg', 'g', 'm3')¶
-
-
class
shoop.core.fields.
MoneyValueField
(**kwargs)[source]¶ Bases:
django.db.models.fields.DecimalField
-
class
shoop.core.fields.
QuantityField
(**kwargs)[source]¶ Bases:
django.db.models.fields.DecimalField
Show known Shoop settings and their values.
-
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 (shoop.core.order_creator.OrderSource) – source object
- kwargs – Other kwargs for future expansion
Returns: name
Return type: unicode
-
get_effective_price_info
(source, **kwargs)[source]¶ Get price of this method for given OrderSource.
Parameters: - source (shoop.core.order_creator.OrderSource) – source object
- kwargs – Other kwargs for future expansion
Return type:
-
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 0x7fa5ca50b390>), ('price_waiver_product_minimum', <django.forms.fields.DecimalField object at 0x7fa5ca520e48>)]¶
-
-
class
shoop.core.methods.base.
BasePaymentMethodModule
(method, options)[source]¶ Bases:
shoop.core.methods.base.BaseMethodModule
Base payment method module implementation.
-
class
shoop.core.methods.base.
BaseShippingMethodModule
(method, options)[source]¶ Bases:
shoop.core.methods.base.BaseMethodModule
Base shipping method module implementation.
-
no_lower_limit_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
option_fields
= [('price', <django.forms.fields.DecimalField object at 0x7fa5ca50b390>), ('price_waiver_product_minimum', <django.forms.fields.DecimalField object at 0x7fa5ca520e48>), ('min_weight', <django.forms.fields.DecimalField object at 0x7fa5ca50bba8>), ('max_weight', <django.forms.fields.DecimalField object at 0x7fa5ca50bc18>)]¶
-
-
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>¶
-
-
class
shoop.core.models.addresses.
Address
(id, prefix, name, suffix, name_ext, company_name, tax_number, 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
¶
-
exception
Address.
MultipleObjectsReturned
¶
-
Address.
billing_orders
¶
-
Address.
get_country_display
(*moreargs, **morekwargs)¶
-
Address.
is_european_union
¶
-
Address.
is_home
¶
-
Address.
objects
= <shoop.core.models.addresses.AddressManager object>¶
-
Address.
saved_addresses
¶
-
Address.
shipping_orders
¶
-
exception
-
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
¶
-
exception
SavedAddress.
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.
-
exception
-
class
shoop.core.models.attributes.
AppliedAttribute
(*args, **kwargs)[source]¶ Bases:
parler.models.TranslatableModel
-
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]¶
-
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: Returns: Attribute value (or fallback)
Return type:
-
classmethod
-
class
shoop.core.models.attributes.
Attribute
(id, identifier, searchable, type, visibility_mode)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
Attribute.
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.
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.
-
exception
-
class
shoop.core.models.attributes.
AttributeQuerySet
(*args, **kwargs)[source]¶ Bases:
parler.managers.TranslatableQuerySet
-
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
¶
-
AttributeTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
AttributeTranslation.
master
¶
-
AttributeTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.categories.
Category
(id, parent, identifier, status, image, ordering, visibility)[source]¶ Bases:
mptt.models.MPTTModel
,parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
Category.
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.
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.
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
¶
-
exception
-
class
shoop.core.models.categories.
CategoryLogEntry
(id, created_on, user, message, identifier, kind, extra, target)¶ Bases:
shoop.utils.analog.BaseLogEntry
-
exception
DoesNotExist
¶
-
exception
CategoryLogEntry.
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.
objects
= <django.db.models.manager.Manager object>¶
-
CategoryLogEntry.
target
¶
-
CategoryLogEntry.
user
¶
-
exception
-
class
shoop.core.models.categories.
CategoryManager
[source]¶ Bases:
parler.managers.TranslatableManager
,mptt.managers.TreeManager
-
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
¶
-
CategoryTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
CategoryTranslation.
master
¶
-
CategoryTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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.
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¶
-
exception
-
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, tax_number)[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¶
-
exception
-
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
¶
-
exception
Contact.
MultipleObjectsReturned
¶
-
Contact.
anonymouscontact
¶
-
Contact.
base_objects
= <django.db.models.manager.Manager object>¶
-
Contact.
company_memberships
¶
-
Contact.
companycontact
¶
-
Contact.
customer_baskets
¶
-
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.
tax_group
¶
-
Contact.
timezone
¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
-
class
shoop.core.models.contacts.
ContactGroup
(id, identifier, show_pricing)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ContactGroup.
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
¶
-
exception
-
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
¶
-
ContactGroupTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
ContactGroupTranslation.
master
¶
-
ContactGroupTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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_baskets
¶
-
PersonContact.
orderer_orders
¶
-
PersonContact.
polymorphic_primary_key_name
= 'id'¶
-
PersonContact.
polymorphic_super_sub_accessors_replaced
= False¶
-
PersonContact.
user
¶
-
exception
-
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 :rtype PersonContact|AnonymousContact
-
class
shoop.core.models.counters.
Counter
(id, value)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Counter.
MultipleObjectsReturned
¶
-
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>¶
-
exception
-
class
shoop.core.models.manufacturers.
Manufacturer
(id, created_on, identifier, name, url)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Manufacturer.
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
¶
-
exception
-
class
shoop.core.models.methods.
ShippingMethod
(id, tax_class, status, identifier, module_identifier, module_data)[source]¶ Bases:
shoop.core.models.methods.Method
-
exception
DoesNotExist
¶
-
exception
ShippingMethod.
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>¶
-
exception
-
class
shoop.core.models.methods.
PaymentMethod
(id, tax_class, status, identifier, module_identifier, module_data)[source]¶ Bases:
shoop.core.models.methods.Method
-
exception
DoesNotExist
¶
-
exception
PaymentMethod.
MultipleObjectsReturned
¶
-
PaymentMethod.
contact_set
¶
-
PaymentMethod.
default_module_spec
= 'shoop.core.methods.default:DefaultPaymentMethodModule'¶
-
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.
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>¶
-
exception
-
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, base_unit_price_value, discount_amount_value)[source]¶ Bases:
django.db.models.base.Model
,shoop.core.pricing.priceful.Priceful
-
exception
DoesNotExist
¶
-
exception
OrderLine.
MultipleObjectsReturned
¶
-
OrderLine.
base_unit_price
¶ Property for Price object.
Similar to MoneyProperty but also has
includes_tax
field.Operaters with TaxfulPrice and TaxlessPrice objects.
-
OrderLine.
child_lines
¶
-
OrderLine.
discount_amount
¶ Property for Price object.
Similar to MoneyProperty but also has
includes_tax
field.Operaters with TaxfulPrice and TaxlessPrice objects.
-
OrderLine.
get_type_display
(*moreargs, **morekwargs)¶
-
OrderLine.
objects
= <shoop.core.models.order_lines.OrderLineManager object>¶
-
OrderLine.
order
¶
-
OrderLine.
parent_line
¶
-
OrderLine.
product
¶
-
OrderLine.
supplier
¶
-
OrderLine.
tax_amount
¶ Return type: shoop.utils.money.Money
-
OrderLine.
taxes
¶
-
OrderLine.
type
¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
-
class
shoop.core.models.order_lines.
OrderLineManager
[source]¶ Bases:
django.db.models.manager.Manager
-
class
shoop.core.models.order_lines.
OrderLineTax
(id, order_line, tax, name, amount_value, base_amount_value, ordering)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.core.models._base.ShoopModel
,shoop.core.taxing._line_tax.LineTax
-
exception
DoesNotExist
¶
-
exception
OrderLineTax.
MultipleObjectsReturned
¶
-
OrderLineTax.
amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
OrderLineTax.
base_amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
OrderLineTax.
objects
= <django.db.models.manager.Manager object>¶
-
OrderLineTax.
order_line
¶
-
OrderLineTax.
tax
¶
-
exception
-
class
shoop.core.models.orders.
Order
(id, shop, created_on, identifier, label, key, reference_number, customer, orderer, billing_address, shipping_address, tax_number, 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_value, taxless_total_price_value, currency, prices_include_tax, 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
¶
-
exception
Order.
MultipleObjectsReturned
¶
-
Order.
add_log_entry
(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)¶
-
Order.
billing_address
¶
-
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 (Money) – Amount of the payment to be created
- payment_identifier (str|None) – 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 (str) – Description of the payment. Will be set to method property of the created payment.
Returns: The created Payment object
Return type:
-
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:
-
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.
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_shipping_status_display
(*moreargs, **morekwargs)¶
-
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.
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
¶
-
Order.
taxful_total_price
¶
-
Order.
taxless_total_price
¶
-
exception
-
class
shoop.core.models.orders.
OrderLogEntry
(id, created_on, user, message, identifier, kind, extra, target)¶ Bases:
shoop.utils.analog.BaseLogEntry
-
exception
DoesNotExist
¶
-
exception
OrderLogEntry.
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.
objects
= <django.db.models.manager.Manager object>¶
-
OrderLogEntry.
target
¶
-
OrderLogEntry.
user
¶
-
exception
-
class
shoop.core.models.orders.
OrderQuerySet
(model=None, query=None, using=None, hints=None)[source]¶
-
class
shoop.core.models.orders.
OrderStatus
(id, identifier, ordering, role, default)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
OrderStatus.
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.
translations
¶
-
exception
-
class
shoop.core.models.orders.
OrderStatusQuerySet
(*args, **kwargs)[source]¶ Bases:
parler.managers.TranslatableQuerySet
-
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
¶
-
OrderStatusTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
OrderStatusTranslation.
master
¶
-
OrderStatusTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.payments.
Payment
(id, order, created_on, gateway_id, payment_identifier, amount_value, foreign_amount_value, foreign_currency, description)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Payment.
MultipleObjectsReturned
¶
-
Payment.
amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
Payment.
foreign_amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
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
¶
-
exception
-
class
shoop.core.models.persistent_cache.
PersistentCacheEntry
(id, module, key, time, data)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
PersistentCacheEntry.
MultipleObjectsReturned
¶
-
PersistentCacheEntry.
get_next_by_time
(*moreargs, **morekwargs)¶
-
PersistentCacheEntry.
get_previous_by_time
(*moreargs, **morekwargs)¶
-
PersistentCacheEntry.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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
¶
-
exception
ProductMedia.
MultipleObjectsReturned
¶
-
ProductMedia.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
ProductMedia.
easy_thumbnails_thumbnailer
¶ Get Thumbnailer instance.
Will return None if file cannot be thumbnailed.
:rtype:easy_thumbnails.files.Thumbnailer|None
-
ProductMedia.
effective_title
¶
-
ProductMedia.
file
¶
-
ProductMedia.
get_kind_display
(*moreargs, **morekwargs)¶
-
ProductMedia.
get_thumbnail
(**kwargs)[source]¶ Get thumbnail for image
This will return None if there is no file or kind is not ProductMediaKind.IMAGE
Return type: easy_thumbnails.files.ThumbnailFile|None
-
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
¶
-
exception
-
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
¶
-
ProductMediaTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
ProductMediaTranslation.
master
¶
-
ProductMediaTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.product_packages.
ProductPackageLink
(id, parent, child, quantity)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ProductPackageLink.
MultipleObjectsReturned
¶
-
ProductPackageLink.
child
¶
-
ProductPackageLink.
objects
= <django.db.models.manager.Manager object>¶
-
ProductPackageLink.
parent
¶
-
exception
-
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, default_price_value)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ShopProduct.
MultipleObjectsReturned
¶
-
ShopProduct.
categories
¶
-
ShopProduct.
default_price
¶ Property for Price object.
Similar to MoneyProperty but also has
includes_tax
field.Operaters with TaxfulPrice and TaxlessPrice objects.
-
ShopProduct.
get_orderability_errors
(supplier, quantity, customer, ignore_minimum=False)[source]¶ Yield ValidationErrors that would cause this product to not be orderable.
Parameters: - supplier (shoop.core.models.suppliers.Supplier) – Supplier to order this product from. May be None.
- quantity (int|Decimal) – Quantity to order.
- customer (shoop.core.models.Contact) – Customer contact.
- ignore_minimum (bool) – Ignore any limitations caused by quantity minimums.
Returns: Iterable[ValidationError]
-
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.
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.
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.
-
exception
-
class
shoop.core.models.product_variation.
ProductVariationVariable
(id, product, identifier)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ProductVariationVariable.
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
¶
-
exception
-
class
shoop.core.models.product_variation.
ProductVariationVariableValue
(id, variable, identifier)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ProductVariationVariableValue.
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
¶
-
exception
-
class
shoop.core.models.product_variation.
ProductVariationResult
(id, product, combination_hash, result, status)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ProductVariationResult.
MultipleObjectsReturned
¶
-
ProductVariationResult.
get_status_display
(*moreargs, **morekwargs)¶
-
ProductVariationResult.
objects
= <django.db.models.manager.Manager object>¶
-
ProductVariationResult.
product
¶
-
ProductVariationResult.
result
¶
-
ProductVariationResult.
status
¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
-
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, manufacturer, primary_image)[source]¶ Bases:
shoop.core.taxing._taxable.TaxableItem
,shoop.core.models.attributes.AttributableMixin
,parler.models.TranslatableModel
-
COMMON_SELECT_RELATED
= ('type', 'primary_image', 'tax_class')¶
-
exception
DoesNotExist
¶
-
exception
Product.
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.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Product.
get_base_price
(context, quantity=1)[source]¶ Get base price of the product within given context.
Base price differs from the (effective) price when there are discounts in effect.
Return type: shoop.core.pricing.Price
-
Product.
get_cheapest_child_price_info
(context, quantity=1)[source]¶ Get the PriceInfo of the cheapest variation child
The attribute used for sorting is PriceInfo.price.
Return None if self.variation_children do not exist. This is because we cannot return anything sensible.
Return type: shoop.core.pricing.PriceInfo
-
Product.
get_child_price_range
(context, quantity=1)[source]¶ Get the prices for cheapest and the most expensive child
The attribute used for sorting is PriceInfo.price.
Return (None, None) if self.variation_children do not exist. This is because we cannot return anything sensible.
Returns: a tuple of prices Return type: (shoop.core.pricing.Price, shoop.core.pricing.Price)
-
Product.
get_mode_display
(*moreargs, **morekwargs)¶
-
Product.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Product.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
Product.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Product.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
Product.
get_price
(context, quantity=1)[source]¶ Get price of the product within given context.
Note
When the current pricing module implements pricing steps, it is possible that
p.get_price(ctx) * 123
is not equal top.get_price(ctx, quantity=123)
, since there could be quantity discounts in effect, but usually they are equal.Return type: shoop.core.pricing.Price
-
Product.
get_price_info
(context, quantity=1)[source]¶ Get PriceInfo object for the product in given context.
Returned PriceInfo object contains calculated price and base_price. The calculation of prices is handled in the current pricing module.
Return type: shoop.core.pricing.PriceInfo
-
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.
keywords
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Product.
link_to_parent
(parent, variables=None, combination_hash=None)[source]¶ Parameters: - parent (Product) – The parent to link to.
- variables (dict|None) – Optional dict of {variable identifier: value identifier} for complex variable linkage
- combination_hash (str|None) – Optional combination hash (for variable variations), if precomputed. Mutually exclusive with variables
-
Product.
log_entries
¶
-
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.
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.
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
¶
-
-
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
¶
-
exception
ProductAttribute.
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
¶
-
exception
-
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
¶
-
ProductAttributeTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
ProductAttributeTranslation.
master
¶
-
ProductAttributeTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.products.
ProductCrossSell
(id, product1, product2, weight, type)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ProductCrossSell.
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.
-
exception
-
class
shoop.core.models.products.
ProductLogEntry
(id, created_on, user, message, identifier, kind, extra, target)¶ Bases:
shoop.utils.analog.BaseLogEntry
-
exception
DoesNotExist
¶
-
exception
ProductLogEntry.
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.
objects
= <django.db.models.manager.Manager object>¶
-
ProductLogEntry.
target
¶
-
ProductLogEntry.
user
¶
-
exception
-
class
shoop.core.models.products.
ProductQuerySet
(*args, **kwargs)[source]¶ Bases:
parler.managers.TranslatableQuerySet
-
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
¶
-
ProductTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
ProductTranslation.
master
¶
-
ProductTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.products.
ProductType
(id, identifier)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ProductType.
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
¶
-
exception
-
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
¶
-
ProductTypeTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
ProductTypeTranslation.
master
¶
-
ProductTypeTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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
¶
-
exception
Shipment.
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
¶
-
exception
-
class
shoop.core.models.shipments.
ShipmentProduct
(id, shipment, product, quantity, unit_volume, unit_weight)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ShipmentProduct.
MultipleObjectsReturned
¶
-
ShipmentProduct.
objects
= <django.db.models.manager.Manager object>¶
-
ShipmentProduct.
product
¶
-
ShipmentProduct.
shipment
¶
-
exception
-
class
shoop.core.models.shops.
Shop
(id, identifier, domain, status, owner, options, currency, prices_include_tax, logo, maintenance_mode)[source]¶ Bases:
shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
Shop.
MultipleObjectsReturned
¶
-
Shop.
categories
¶
-
Shop.
create_price
(value)[source]¶ Create a price with given value and settings of this shop.
Takes the
prices_include_tax
andcurrency
settings of this Shop into account.Return type: shoop.core.pricing.Price
-
Shop.
discountedproductprice_set
¶
-
Shop.
get_status_display
(*moreargs, **morekwargs)¶
-
Shop.
logo
¶
-
Shop.
maintenance_message
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
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.
public_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Shop.
shop_products
¶
-
Shop.
simpleproductprice_set
¶
-
Shop.
status
¶ A placeholder class that provides a way to set the attribute on the model.
-
Shop.
storedbasket_set
¶
-
Shop.
translations
¶
-
exception
-
class
shoop.core.models.shops.
ShopTranslation
(id, language_code, name, public_name, maintenance_message, master)¶ Bases:
parler.models.TranslatedFieldsModel
-
exception
DoesNotExist
¶ Bases:
parler.models.TranslationDoesNotExist
,shoop.core.models.shops.DoesNotExist
,shoop.core.models.shops.DoesNotExist
-
exception
ShopTranslation.
MultipleObjectsReturned
¶
-
ShopTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
ShopTranslation.
master
¶
-
ShopTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.supplied_products.
SuppliedProduct
(id, supplier, product, sku, alert_limit, physical_count, logical_count)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
SuppliedProduct.
MultipleObjectsReturned
¶
-
SuppliedProduct.
objects
= <django.db.models.manager.Manager object>¶
-
SuppliedProduct.
product
¶
-
SuppliedProduct.
supplier
¶
-
exception
-
class
shoop.core.models.suppliers.
Supplier
(id, identifier, name, type, stock_managed, module_identifier, module_data)[source]¶ Bases:
shoop.core.modules.interface.ModuleInterface
,shoop.core.models._base.ShoopModel
-
exception
DoesNotExist
¶
-
exception
Supplier.
MultipleObjectsReturned
¶
-
Supplier.
default_module_spec
= 'shoop.core.suppliers:BaseSupplierModule'¶
-
Supplier.
get_orderability_errors
(shop_product, quantity, customer)[source]¶ Parameters: - shop_product (shoop.core.models.ShopProduct) – Shop Product
- quantity (decimal.Decimal) – Quantity to order
- contect (shoop.core.models.Contact) – Ordering contact.
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.
-
exception
-
class
shoop.core.models.taxes.
CustomerTaxGroup
(id, identifier, enabled)[source]¶ Bases:
shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
CustomerTaxGroup.
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
¶
-
exception
-
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
¶
-
CustomerTaxGroupTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
CustomerTaxGroupTranslation.
master
¶
-
CustomerTaxGroupTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.taxes.
Tax
(id, code, rate, amount_value, currency, enabled)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.core.models._base.ImmutableMixin
,shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
Tax.
MultipleObjectsReturned
¶
-
Tax.
amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
Tax.
calculate_amount
(base_amount)[source]¶ Calculate tax amount with this tax for given base amount.
Return type: shoop.utils.money.Money
-
Tax.
identifier_attr
= 'code'¶
-
Tax.
immutability_message
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
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.
taxrule_set
¶
-
Tax.
translations
¶
-
Tax.
unprotected_fields
= ['enabled']¶
-
exception
-
class
shoop.core.models.taxes.
TaxClass
(id, identifier, enabled)[source]¶ Bases:
shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
TaxClass.
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
¶
-
exception
-
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
¶
-
TaxClassTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
TaxClassTranslation.
master
¶
-
TaxClassTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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
¶
-
TaxTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
TaxTranslation.
master
¶
-
TaxTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.core.models.units.
SalesUnit
(id, identifier, decimals)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
SalesUnit.
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.
short_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
SalesUnit.
translations
¶
-
exception
-
class
shoop.core.models.
Address
(id, prefix, name, suffix, name_ext, company_name, tax_number, 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
¶
-
exception
Address.
MultipleObjectsReturned
¶
-
Address.
billing_orders
¶
-
Address.
get_country_display
(*moreargs, **morekwargs)¶
-
Address.
is_european_union
¶
-
Address.
is_home
¶
-
Address.
objects
= <shoop.core.models.addresses.AddressManager object>¶
-
Address.
saved_addresses
¶
-
Address.
shipping_orders
¶
-
exception
-
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.
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¶
-
exception
-
class
shoop.core.models.
Attribute
(id, identifier, searchable, type, visibility_mode)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
Attribute.
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.
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.
-
exception
-
class
shoop.core.models.
Category
(id, parent, identifier, status, image, ordering, visibility)[source]¶ Bases:
mptt.models.MPTTModel
,parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
Category.
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.
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.
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
¶
-
exception
-
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, tax_number)[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¶
-
exception
-
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
¶
-
exception
Contact.
MultipleObjectsReturned
¶
-
Contact.
anonymouscontact
¶
-
Contact.
base_objects
= <django.db.models.manager.Manager object>¶
-
Contact.
company_memberships
¶
-
Contact.
companycontact
¶
-
Contact.
customer_baskets
¶
-
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.
tax_group
¶
-
Contact.
timezone
¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
-
class
shoop.core.models.
ContactGroup
(id, identifier, show_pricing)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ContactGroup.
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
¶
-
exception
-
class
shoop.core.models.
Counter
(id, value)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Counter.
MultipleObjectsReturned
¶
-
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>¶
-
exception
-
class
shoop.core.models.
CustomerTaxGroup
(id, identifier, enabled)[source]¶ Bases:
shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
CustomerTaxGroup.
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
¶
-
exception
-
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 :rtype PersonContact|AnonymousContact
-
class
shoop.core.models.
Manufacturer
(id, created_on, identifier, name, url)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Manufacturer.
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
¶
-
exception
-
class
shoop.core.models.
Order
(id, shop, created_on, identifier, label, key, reference_number, customer, orderer, billing_address, shipping_address, tax_number, 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_value, taxless_total_price_value, currency, prices_include_tax, 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
¶
-
exception
Order.
MultipleObjectsReturned
¶
-
Order.
add_log_entry
(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)¶
-
Order.
billing_address
¶
-
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 (Money) – Amount of the payment to be created
- payment_identifier (str|None) – 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 (str) – Description of the payment. Will be set to method property of the created payment.
Returns: The created Payment object
Return type:
-
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:
-
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.
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_shipping_status_display
(*moreargs, **morekwargs)¶
-
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.
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
¶
-
Order.
taxful_total_price
¶
-
Order.
taxless_total_price
¶
-
exception
-
class
shoop.core.models.
OrderLine
(id, order, product, supplier, parent_line, ordering, type, sku, text, accounting_identifier, require_verification, verified, extra_data, quantity, base_unit_price_value, discount_amount_value)[source]¶ Bases:
django.db.models.base.Model
,shoop.core.pricing.priceful.Priceful
-
exception
DoesNotExist
¶
-
exception
OrderLine.
MultipleObjectsReturned
¶
-
OrderLine.
base_unit_price
¶ Property for Price object.
Similar to MoneyProperty but also has
includes_tax
field.Operaters with TaxfulPrice and TaxlessPrice objects.
-
OrderLine.
child_lines
¶
-
OrderLine.
discount_amount
¶ Property for Price object.
Similar to MoneyProperty but also has
includes_tax
field.Operaters with TaxfulPrice and TaxlessPrice objects.
-
OrderLine.
get_type_display
(*moreargs, **morekwargs)¶
-
OrderLine.
objects
= <shoop.core.models.order_lines.OrderLineManager object>¶
-
OrderLine.
order
¶
-
OrderLine.
parent_line
¶
-
OrderLine.
product
¶
-
OrderLine.
supplier
¶
-
OrderLine.
tax_amount
¶ Return type: shoop.utils.money.Money
-
OrderLine.
taxes
¶
-
OrderLine.
type
¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
-
class
shoop.core.models.
OrderLineTax
(id, order_line, tax, name, amount_value, base_amount_value, ordering)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.core.models._base.ShoopModel
,shoop.core.taxing._line_tax.LineTax
-
exception
DoesNotExist
¶
-
exception
OrderLineTax.
MultipleObjectsReturned
¶
-
OrderLineTax.
amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
OrderLineTax.
base_amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
OrderLineTax.
objects
= <django.db.models.manager.Manager object>¶
-
OrderLineTax.
order_line
¶
-
OrderLineTax.
tax
¶
-
exception
-
class
shoop.core.models.
OrderLogEntry
(id, created_on, user, message, identifier, kind, extra, target)¶ Bases:
shoop.utils.analog.BaseLogEntry
-
exception
DoesNotExist
¶
-
exception
OrderLogEntry.
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.
objects
= <django.db.models.manager.Manager object>¶
-
OrderLogEntry.
target
¶
-
OrderLogEntry.
user
¶
-
exception
-
class
shoop.core.models.
OrderStatus
(id, identifier, ordering, role, default)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
OrderStatus.
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.
translations
¶
-
exception
-
class
shoop.core.models.
Payment
(id, order, created_on, gateway_id, payment_identifier, amount_value, foreign_amount_value, foreign_currency, description)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Payment.
MultipleObjectsReturned
¶
-
Payment.
amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
Payment.
foreign_amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
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
¶
-
exception
-
class
shoop.core.models.
PaymentMethod
(id, tax_class, status, identifier, module_identifier, module_data)[source]¶ Bases:
shoop.core.models.methods.Method
-
exception
DoesNotExist
¶
-
exception
PaymentMethod.
MultipleObjectsReturned
¶
-
PaymentMethod.
contact_set
¶
-
PaymentMethod.
default_module_spec
= 'shoop.core.methods.default:DefaultPaymentMethodModule'¶
-
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.
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>¶
-
exception
-
class
shoop.core.models.
PersistentCacheEntry
(id, module, key, time, data)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
PersistentCacheEntry.
MultipleObjectsReturned
¶
-
PersistentCacheEntry.
get_next_by_time
(*moreargs, **morekwargs)¶
-
PersistentCacheEntry.
get_previous_by_time
(*moreargs, **morekwargs)¶
-
PersistentCacheEntry.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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_baskets
¶
-
PersonContact.
orderer_orders
¶
-
PersonContact.
polymorphic_primary_key_name
= 'id'¶
-
PersonContact.
polymorphic_super_sub_accessors_replaced
= False¶
-
PersonContact.
user
¶
-
exception
-
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, manufacturer, primary_image)[source]¶ Bases:
shoop.core.taxing._taxable.TaxableItem
,shoop.core.models.attributes.AttributableMixin
,parler.models.TranslatableModel
-
COMMON_SELECT_RELATED
= ('type', 'primary_image', 'tax_class')¶
-
exception
DoesNotExist
¶
-
exception
Product.
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.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Product.
get_base_price
(context, quantity=1)[source]¶ Get base price of the product within given context.
Base price differs from the (effective) price when there are discounts in effect.
Return type: shoop.core.pricing.Price
-
Product.
get_cheapest_child_price_info
(context, quantity=1)[source]¶ Get the PriceInfo of the cheapest variation child
The attribute used for sorting is PriceInfo.price.
Return None if self.variation_children do not exist. This is because we cannot return anything sensible.
Return type: shoop.core.pricing.PriceInfo
-
Product.
get_child_price_range
(context, quantity=1)[source]¶ Get the prices for cheapest and the most expensive child
The attribute used for sorting is PriceInfo.price.
Return (None, None) if self.variation_children do not exist. This is because we cannot return anything sensible.
Returns: a tuple of prices Return type: (shoop.core.pricing.Price, shoop.core.pricing.Price)
-
Product.
get_mode_display
(*moreargs, **morekwargs)¶
-
Product.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Product.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
Product.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Product.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
Product.
get_price
(context, quantity=1)[source]¶ Get price of the product within given context.
Note
When the current pricing module implements pricing steps, it is possible that
p.get_price(ctx) * 123
is not equal top.get_price(ctx, quantity=123)
, since there could be quantity discounts in effect, but usually they are equal.Return type: shoop.core.pricing.Price
-
Product.
get_price_info
(context, quantity=1)[source]¶ Get PriceInfo object for the product in given context.
Returned PriceInfo object contains calculated price and base_price. The calculation of prices is handled in the current pricing module.
Return type: shoop.core.pricing.PriceInfo
-
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.
keywords
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Product.
link_to_parent
(parent, variables=None, combination_hash=None)[source]¶ Parameters: - parent (Product) – The parent to link to.
- variables (dict|None) – Optional dict of {variable identifier: value identifier} for complex variable linkage
- combination_hash (str|None) – Optional combination hash (for variable variations), if precomputed. Mutually exclusive with variables
-
Product.
log_entries
¶
-
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.
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.
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
¶
-
-
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, manufacturer, primary_image)[source] Bases:
shoop.core.taxing._taxable.TaxableItem
,shoop.core.models.attributes.AttributableMixin
,parler.models.TranslatableModel
-
COMMON_SELECT_RELATED
= ('type', 'primary_image', 'tax_class')
-
exception
DoesNotExist
-
exception
Product.
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_all_package_children
()[source]
-
Product.
get_all_package_parents
()[source]
-
Product.
get_available_attribute_queryset
()[source]
-
Product.
get_base_price
(context, quantity=1)[source] Get base price of the product within given context.
Base price differs from the (effective) price when there are discounts in effect.
Return type: shoop.core.pricing.Price
-
Product.
get_cheapest_child_price
(context, quantity=1)[source]
-
Product.
get_cheapest_child_price_info
(context, quantity=1)[source] Get the PriceInfo of the cheapest variation child
The attribute used for sorting is PriceInfo.price.
Return None if self.variation_children do not exist. This is because we cannot return anything sensible.
Return type: shoop.core.pricing.PriceInfo
-
Product.
get_child_price_range
(context, quantity=1)[source] Get the prices for cheapest and the most expensive child
The attribute used for sorting is PriceInfo.price.
Return (None, None) if self.variation_children do not exist. This is because we cannot return anything sensible.
Returns: a tuple of prices Return type: (shoop.core.pricing.Price, shoop.core.pricing.Price)
-
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] Get price of the product within given context.
Note
When the current pricing module implements pricing steps, it is possible that
p.get_price(ctx) * 123
is not equal top.get_price(ctx, quantity=123)
, since there could be quantity discounts in effect, but usually they are equal.Return type: shoop.core.pricing.Price
-
Product.
get_price_info
(context, quantity=1)[source] Get PriceInfo object for the product in given context.
Returned PriceInfo object contains calculated price and base_price. The calculation of prices is handled in the current pricing module.
Return type: shoop.core.pricing.PriceInfo
-
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_variation_siblings
()[source]
-
Product.
is_package_child
()[source]
-
Product.
is_package_parent
()[source]
-
Product.
is_variation_child
()[source]
-
Product.
is_variation_parent
()[source]
-
Product.
keywords
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Product.
link_to_parent
(parent, variables=None, combination_hash=None)[source] Parameters: - parent (Product) – The parent to link to.
- variables (dict|None) – Optional dict of {variable identifier: value identifier} for complex variable linkage
- combination_hash (str|None) – Optional combination hash (for variable variations), if precomputed. Mutually exclusive with variables
-
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
¶
-
exception
ProductAttribute.
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
¶
-
exception
-
class
shoop.core.models.
ProductCrossSell
(id, product1, product2, weight, type)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ProductCrossSell.
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.
-
exception
-
class
shoop.core.models.
ProductMedia
(id, identifier, product, kind, file, external_url, ordering, enabled, public, purchased)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ProductMedia.
MultipleObjectsReturned
¶
-
ProductMedia.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
ProductMedia.
easy_thumbnails_thumbnailer
¶ Get Thumbnailer instance.
Will return None if file cannot be thumbnailed.
:rtype:easy_thumbnails.files.Thumbnailer|None
-
ProductMedia.
effective_title
¶
-
ProductMedia.
file
¶
-
ProductMedia.
get_kind_display
(*moreargs, **morekwargs)¶
-
ProductMedia.
get_thumbnail
(**kwargs)[source]¶ Get thumbnail for image
This will return None if there is no file or kind is not ProductMediaKind.IMAGE
Return type: easy_thumbnails.files.ThumbnailFile|None
-
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
¶
-
exception
-
class
shoop.core.models.
ProductPackageLink
(id, parent, child, quantity)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ProductPackageLink.
MultipleObjectsReturned
¶
-
ProductPackageLink.
child
¶
-
ProductPackageLink.
objects
= <django.db.models.manager.Manager object>¶
-
ProductPackageLink.
parent
¶
-
exception
-
class
shoop.core.models.
ProductType
(id, identifier)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ProductType.
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
¶
-
exception
-
class
shoop.core.models.
ProductVariationResult
(id, product, combination_hash, result, status)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ProductVariationResult.
MultipleObjectsReturned
¶
-
ProductVariationResult.
get_status_display
(*moreargs, **morekwargs)¶
-
ProductVariationResult.
objects
= <django.db.models.manager.Manager object>¶
-
ProductVariationResult.
product
¶
-
ProductVariationResult.
result
¶
-
ProductVariationResult.
status
¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
-
class
shoop.core.models.
ProductVariationVariable
(id, product, identifier)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ProductVariationVariable.
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
¶
-
exception
-
class
shoop.core.models.
ProductVariationVariableValue
(id, variable, identifier)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
ProductVariationVariableValue.
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
¶
-
exception
-
class
shoop.core.models.
SalesUnit
(id, identifier, decimals)[source]¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
SalesUnit.
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.
short_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
SalesUnit.
translations
¶
-
exception
-
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
¶
-
exception
SavedAddress.
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.
-
exception
-
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
¶
-
exception
Shipment.
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
¶
-
exception
-
class
shoop.core.models.
ShipmentProduct
(id, shipment, product, quantity, unit_volume, unit_weight)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ShipmentProduct.
MultipleObjectsReturned
¶
-
ShipmentProduct.
objects
= <django.db.models.manager.Manager object>¶
-
ShipmentProduct.
product
¶
-
ShipmentProduct.
shipment
¶
-
exception
-
class
shoop.core.models.
ShippingMethod
(id, tax_class, status, identifier, module_identifier, module_data)[source]¶ Bases:
shoop.core.models.methods.Method
-
exception
DoesNotExist
¶
-
exception
ShippingMethod.
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>¶
-
exception
-
class
shoop.core.models.
Shop
(id, identifier, domain, status, owner, options, currency, prices_include_tax, logo, maintenance_mode)[source]¶ Bases:
shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
Shop.
MultipleObjectsReturned
¶
-
Shop.
categories
¶
-
Shop.
create_price
(value)[source]¶ Create a price with given value and settings of this shop.
Takes the
prices_include_tax
andcurrency
settings of this Shop into account.Return type: shoop.core.pricing.Price
-
Shop.
discountedproductprice_set
¶
-
Shop.
get_status_display
(*moreargs, **morekwargs)¶
-
Shop.
logo
¶
-
Shop.
maintenance_message
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
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.
public_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Shop.
shop_products
¶
-
Shop.
simpleproductprice_set
¶
-
Shop.
status
¶ A placeholder class that provides a way to set the attribute on the model.
-
Shop.
storedbasket_set
¶
-
Shop.
translations
¶
-
exception
-
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, default_price_value)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ShopProduct.
MultipleObjectsReturned
¶
-
ShopProduct.
categories
¶
-
ShopProduct.
default_price
¶ Property for Price object.
Similar to MoneyProperty but also has
includes_tax
field.Operaters with TaxfulPrice and TaxlessPrice objects.
-
ShopProduct.
get_orderability_errors
(supplier, quantity, customer, ignore_minimum=False)[source]¶ Yield ValidationErrors that would cause this product to not be orderable.
Parameters: - supplier (shoop.core.models.suppliers.Supplier) – Supplier to order this product from. May be None.
- quantity (int|Decimal) – Quantity to order.
- customer (shoop.core.models.Contact) – Customer contact.
- ignore_minimum (bool) – Ignore any limitations caused by quantity minimums.
Returns: Iterable[ValidationError]
-
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.
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.
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.
-
exception
-
class
shoop.core.models.
SuppliedProduct
(id, supplier, product, sku, alert_limit, physical_count, logical_count)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
SuppliedProduct.
MultipleObjectsReturned
¶
-
SuppliedProduct.
objects
= <django.db.models.manager.Manager object>¶
-
SuppliedProduct.
product
¶
-
SuppliedProduct.
supplier
¶
-
exception
-
class
shoop.core.models.
Supplier
(id, identifier, name, type, stock_managed, module_identifier, module_data)[source]¶ Bases:
shoop.core.modules.interface.ModuleInterface
,shoop.core.models._base.ShoopModel
-
exception
DoesNotExist
¶
-
exception
Supplier.
MultipleObjectsReturned
¶
-
Supplier.
default_module_spec
= 'shoop.core.suppliers:BaseSupplierModule'¶
-
Supplier.
get_orderability_errors
(shop_product, quantity, customer)[source]¶ Parameters: - shop_product (shoop.core.models.ShopProduct) – Shop Product
- quantity (decimal.Decimal) – Quantity to order
- contect (shoop.core.models.Contact) – Ordering contact.
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.
-
exception
-
class
shoop.core.models.
Tax
(id, code, rate, amount_value, currency, enabled)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.core.models._base.ImmutableMixin
,shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
Tax.
MultipleObjectsReturned
¶
-
Tax.
amount
¶ Property for a Money amount.
Will return Money objects when the property is being get and accepts Money objects on set. Value and currency are read/written from/to other fields.
Fields are given as locators, that is a string in dotted format, e.g. locator
"foo.bar"
points toinstance.foo.bar
whereinstance
is an instance of the class owning the MoneyProperty.Setting value of this property to a Money object with different currency that is currently set (in the field pointed by the currency locator), will raise an UnitMixupError.
-
Tax.
calculate_amount
(base_amount)[source]¶ Calculate tax amount with this tax for given base amount.
Return type: shoop.utils.money.Money
-
Tax.
identifier_attr
= 'code'¶
-
Tax.
immutability_message
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
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.
taxrule_set
¶
-
Tax.
translations
¶
-
Tax.
unprotected_fields
= ['enabled']¶
-
exception
-
class
shoop.core.models.
TaxClass
(id, identifier, enabled)[source]¶ Bases:
shoop.core.models._base.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
TaxClass.
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
¶
-
exception
-
class
shoop.core.modules.interface.
ModuleInterface
[source]¶ Bases:
object
-
default_module_spec
= None¶
-
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
-
class
shoop.core.modules.
ModuleInterface
[source]¶ Bases:
object
-
default_module_spec
= None¶
-
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¶
-
-
class
shoop.core.order_creator.source.
OrderSource
(shop)[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.
-
calculate_taxes_automatically
= None¶ Calculate taxes automatically when lines are added or processed.
Set to False to minimize costs and latency, since it is possible that the current TaxModule implemements tax calculations with an integration to a remote system which charges per transaction.
-
get_final_lines
(with_taxes=False)[source]¶ Get lines with processed lines added.
This implementation includes the all lines returned by get_lines and in addition, lines from shipping and payment methods, but these lines can be extended, deleted or replaced by a subclass (by overriding _compute_processed_lines method) and with the post_compute_source_lines signal.
Note
By default, taxes for the returned lines are not calculated when self.calculate_taxes_automatically is false. Pass in
True
to with_taxes argument or use calculate_taxes method to force tax calculation.
-
payment_method
¶
-
shipping_method
¶
-
status
¶
-
taxful_total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxful_total_discount_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxful_total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxful_total_price_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxless_total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxless_total_discount_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxless_total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxless_total_price_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
total_price_of_products
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
uncache
()[source]¶ Uncache processed lines.
Should be called after changing the contents before (re)accessing lines with
get_final_lines
.
-
-
class
shoop.core.order_creator.source.
SourceLine
(source, **kwargs)[source]¶ Bases:
shoop.core.taxing._taxable.TaxableItem
,shoop.core.pricing.priceful.Priceful
Line of OrderSource.
Note: Properties like total_price, taxful_total_price, tax_rate, etc. are inherited from the Priceful mixin.
-
base_unit_price
= None¶
-
discount_amount
= None¶
-
classmethod
from_dict
(source, data)[source]¶ Create SourceLine from given OrderSource and dict.
Return type: cls
-
quantity
= None¶
-
tax_amount
¶ Return type: shoop.utils.money.Money
-
tax_class
¶
-
taxes
= None¶ Taxes of this line.
Determined by a TaxModule in
OrderSource.calculate_taxes
.Type: list[shoop.core.taxing.LineTax]
-
-
class
shoop.core.order_creator.
OrderCreator
(request)[source]¶ Bases:
object
-
class
shoop.core.order_creator.
OrderSource
(shop)[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
(with_taxes=False)[source]¶ Get lines with processed lines added.
This implementation includes the all lines returned by get_lines and in addition, lines from shipping and payment methods, but these lines can be extended, deleted or replaced by a subclass (by overriding _compute_processed_lines method) and with the post_compute_source_lines signal.
Note
By default, taxes for the returned lines are not calculated when self.calculate_taxes_automatically is false. Pass in
True
to with_taxes argument or use calculate_taxes method to force tax calculation.
-
payment_method
¶
-
shipping_method
¶
-
status
¶
-
taxful_total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxful_total_discount_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxful_total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxful_total_price_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxless_total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxless_total_discount_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
taxless_total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
taxless_total_price_or_none
¶ Property that turns TaxesNotCalculated exception to None.
Used to implement the OrderSource taxful/taxless total price properties with the “_or_none” suffix.
-
total_discount
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
total_price
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
total_price_of_products
¶ Property that calculates sum of prices.
Used to implement various total price proprties to OrderSource.
-
uncache
()[source]¶ Uncache processed lines.
Should be called after changing the contents before (re)accessing lines with
get_final_lines
.
-
-
class
shoop.core.order_creator.
SourceLine
(source, **kwargs)[source]¶ Bases:
shoop.core.taxing._taxable.TaxableItem
,shoop.core.pricing.priceful.Priceful
Line of OrderSource.
Note: Properties like total_price, taxful_total_price, tax_rate, etc. are inherited from the Priceful mixin.
-
base_unit_price
= None¶
-
discount_amount
= None¶
-
classmethod
from_dict
(source, data)[source]¶ Create SourceLine from given OrderSource and dict.
Return type: cls
-
quantity
= None¶
-
tax_amount
¶ Return type: shoop.utils.money.Money
-
tax_class
¶
-
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_info
method.
(Product
objects contain the
convenience methods
get_price_info
,
get_price
,
and get_base_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_price_infos
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
Money amount with taxful/taxless info.
Taxful and taxless prices cannot be mixed in comparison or in calculations, i.e. operations like
x < y
orx + y
for two Pricesx
andy
withx.includes_tax != y.includes_tax
will raise anUnitMixupError
.In addition to includes_tax info, Prices are Money and know their ~shoop.utils.numbers.UnitedDecimal.value and ~shoop.utils.money.Money.currency. To get the bare Money amount of a Price, use the amount property.
-
amount
¶ Money amount of this price.
Return type: Money
-
includes_tax
= None¶
-
-
class
shoop.core.pricing.
Priceful
[source]¶ Bases:
object
Mixin to define price properties based on other price properties.
You must provide at least
quantity
(~decimal.Decimal)
and both
base_unit_price
(~shoop.core.pricing.Price) anddiscount_amount
(~shoop.core.pricing.Price)
or both
price
(~shoop.core.pricing.Price) andbase_price
(~shoop.core.pricing.Price).
You may also provide
tax_amount
(~shoop.utils.money.Money)
to get various tax related properties.
Provided
base_unit_price
,discount_amount
,price
,base_price
, andtax_amount
must have compatible units (i.e. same taxness and currency).- Invariants:
price = base_unit_price * quantity - discount_amount
discount_amount = base_price - price
discount_rate = 1 - (price / base_price)
discount_percentage = 100 * discount_rate
unit_discount_amount = discount_amount / quantity
taxful_price = taxless_price + tax_amount
tax_rate = (taxful_price.amount / taxless_price.amount) - 1
tax_percentage = 100 * tax_rate
-
base_price
¶ Total price for the specified quantity excluding discount.
Return type: shoop.core.pricing.Price
-
base_unit_price
¶ Undiscounted unit price.
Note: If quantity is 0, will return
base_price
.Return type: shoop.core.pricing.Price
-
discount_amount
¶ Amount of discount for the total quantity.
Return type: shoop.core.pricing.Price
-
discount_percentage
¶ Discount percentage, 100 meaning totally discounted.
See discount_rate.
Return type: decimal.Decimal
-
discount_rate
¶ Discount rate, 1 meaning totally discounted.
Note: Could be negative, when base price is smaller than effective price. Could also be greater than 1, when effective price is negative.
If base price is 0, will return 0.
Return type: decimal.Decimal
-
discounted_unit_price
¶ Unit price with discount.
If quantity is 0, will return
base_unit_price - discount_amount
.Return type: shoop.core.pricing.Price
-
is_discounted
¶ Check if there is a discount in effect.
Returns: True, iff price < base price.
-
price
¶ Total price for the specified quantity with discount.
Return type: shoop.core.pricing.Price
-
tax_percentage
¶ Return type: decimal.Decimal
-
tax_rate
¶ Return type: decimal.Decimal
-
taxful_base_price
¶ Taxful base_price
-
taxful_base_unit_price
¶ Taxful base_unit_price
-
taxful_discount_amount
¶ Taxful discount_amount
-
taxful_discounted_unit_price
¶ Taxful discounted_unit_price
-
taxful_price
¶ Return type: TaxfulPrice
-
taxful_total_price
¶ Alias of taxful_price
-
taxful_unit_discount_amount
¶ Taxful unit_discount_amount
-
taxless_base_price
¶ Taxless base_price
-
taxless_base_unit_price
¶ Taxless base_unit_price
-
taxless_discount_amount
¶ Taxless discount_amount
-
taxless_discounted_unit_price
¶ Taxless discounted_unit_price
-
taxless_price
¶ Return type: TaxlessPrice
-
taxless_total_price
¶ Alias of taxless_price
-
taxless_unit_discount_amount
¶ Taxless unit_discount_amount
-
total_price
¶ Alias of price
-
unit_discount_amount
¶ Discount amount per unit.
If quantity is 0, will return
discount_amount
.Return type: shoop.core.pricing.Price
-
class
shoop.core.pricing.
PriceInfo
(price, base_price, quantity, expires_on=None)[source]¶ Bases:
shoop.core.pricing.priceful.Priceful
-
base_price
= None¶
-
price
= None¶
-
quantity
= None¶
-
-
class
shoop.core.pricing.
PricingContext
(**kwargs)[source]¶ Bases:
object
-
REQUIRED_VALUES
= ()¶
-
cache_key
¶
-
-
class
shoop.core.pricing.
PricingModule
[source]¶ Bases:
object
-
get_context
(context)[source]¶ Return type: PricingContext
-
get_price_info
(context, product, quantity=1)[source]¶ Parameters: product (shoop.core.models.Product|int) – Product object or id of Product Return type: PriceInfo
-
get_price_infos
(context, products, quantity=1)[source]¶ Get PriceInfo objects for a bunch of products.
Returns a dict with product id as key and PriceInfo as value.
May be faster than doing
get_price_info
for each product separately, since inheriting class may override this.Parameters: products (Iterable[shoop.core.models.Product|int]) – a list of `Product`s or id’s Return type: dict[int,PriceInfo]
-
get_pricing_steps
(context, product)[source]¶ Get context-specific list pricing steps for the given product.
Returns a list of PriceInfos
[pi0, pi1, pi2, ...]
where each PriceInfo object is at the border unit price change: unit price for0 <= quantity < pi1.quantity1
ispi0.discounted_unit_price
, and unit price forpi1.quantity <= quantity < pi2.quantity
ispi1.discounted_unit_price
, and so on.If there are “no steps”, the return value will be a list of single PriceInfo object with the constant price, i.e.
[price_info]
.Parameters: product (shoop.core.models.Product|int) – Product or product id Return type: list[PriceInfo]
-
get_pricing_steps_for_products
(context, products)[source]¶ Get pricing steps for a bunch of products.
Returns a dict with product id as key and step data (as list of PriceInfos) as values.
May be faster than doing
get_pricing_steps
for each product separately, since inheriting class may override this.Parameters: products (Iterable[shoop.core.models.Product|int]) – a list of `Product`s or id’s Return type: dict[int,list[PriceInfo]]
-
identifier
= None¶
-
name
= None¶
-
pricing_context_class
¶ alias of
PricingContext
-
-
class
shoop.core.pricing.
TaxfulPrice
[source]¶ Bases:
shoop.core.pricing.price.Price
Price which includes taxes.
Check the base class,
Price
, for more info.-
includes_tax
= True¶
-
-
class
shoop.core.pricing.
TaxlessPrice
[source]¶ Bases:
shoop.core.pricing.price.Price
Price which does not include taxes.
Check the base class,
Price
, for more info.-
includes_tax
= False¶
-
-
shoop.core.pricing.
get_pricing_module
()[source]¶ Return type: shoop.core.pricing.PricingModule
-
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
-
class
shoop.core.suppliers.base.
BaseSupplierModule
(supplier, options)[source]¶ Bases:
object
Base supplier module implementation.
-
get_orderability_errors
(shop_product, quantity, customer)[source]¶ Parameters: - shop_product (shoop.core.models.ShopProduct) – Shop Product
- quantity (decimal.Decimal) – Quantity to order
- customer – Contact
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¶
-
-
class
shoop.core.suppliers.
BaseSupplierModule
(supplier, options)[source]¶ Bases:
object
Base supplier module implementation.
-
get_orderability_errors
(shop_product, quantity, customer)[source]¶ Parameters: - shop_product (shoop.core.models.ShopProduct) – Shop Product
- quantity (decimal.Decimal) – Quantity to order
- customer – Contact
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¶
-
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"
)
Format money amount according to current locale settings.
Parameters: Returns: Formatted string representing the given amount
Return type:
-
exception
shoop.core.utils.vat.
VatCannotIdentifyValidationError
(*args, **kwargs)[source]¶ Bases:
shoop.core.utils.vat.VatValidationError
-
code
= 'vat_cannot_identify'¶
-
-
exception
shoop.core.utils.vat.
VatInvalidValidationError
(*args, **kwargs)[source]¶ Bases:
shoop.core.utils.vat.VatValidationError
-
code
= 'vat_invalid'¶
-
-
exception
shoop.core.utils.vat.
VatValidationError
(*args, **kwargs)[source]¶ Bases:
django.core.exceptions.ValidationError
-
code
= None¶
-
-
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: Returns: Tuple of (prefix, code_parts)
-
exception
shoop.core.excs.
ImmutabilityError
[source]¶ Bases:
ValueError
-
exception
shoop.core.excs.
ImpossibleProductModeException
(message, code=None)[source]¶ Bases:
ValueError
-
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.
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 inSHOOP_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
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.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
-
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'], 'pricing_module': ['shoop.core.pricing.default_pricing:DefaultPricingModule']}¶
-
required_installed_apps
= ('django.contrib.auth', 'django.contrib.contenttypes', 'easy_thumbnails', 'filer')¶
-
verbose_name
= 'Shoop Core'¶
-
-
class
shoop.front.apps.auth.views.
LoginView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
-
form_class
¶ alias of
AuthenticationForm
-
template_name
= 'shoop/user/login.jinja'¶
-
-
class
shoop.front.apps.auth.views.
LogoutView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
-
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
-
form_class
¶ alias of
SetPasswordForm
-
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 0x7fa5cce9e128>)])¶
-
declared_fields
= OrderedDict([('email', <django.forms.fields.EmailField object at 0x7fa5cce9e128>)])¶
-
email_template_name
= 'shoop/user/recover_password_mail_content.jinja'¶
-
from_email
= None¶
-
media
¶
-
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
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/user/recover_password.jinja'¶
-
-
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 0x7fa5ccea5320>), ('phone', <django.forms.fields.CharField object at 0x7fa5ccea54a8>), ('email', <django.forms.fields.EmailField object at 0x7fa5ccea5668>), ('street', <django.forms.fields.CharField object at 0x7fa5ccea57b8>), ('street2', <django.forms.fields.CharField object at 0x7fa5ccea5940>), ('postal_code', <django.forms.fields.CharField object at 0x7fa5ccea5ac8>), ('city', <django.forms.fields.CharField object at 0x7fa5ccea5c50>), ('region', <django.forms.fields.CharField object at 0x7fa5ccea5dd8>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7fa5ccea5f98>)])¶
-
AddressForm.
declared_fields
= OrderedDict()¶
-
AddressForm.
media
¶
-
class
-
class
shoop.front.apps.customer_information.views.
CustomerEditView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
-
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 0x7fa5cce9ee10>), ('phone', <django.forms.fields.CharField object at 0x7fa5cce9ec88>), ('email', <django.forms.fields.EmailField object at 0x7fa5cce9efd0>), ('gender', <enumfields.forms.EnumChoiceField object at 0x7fa5ccea5160>), ('marketing_permission', <django.forms.fields.BooleanField object at 0x7fa5cce9eba8>)])¶
-
PersonContactForm.
declared_fields
= OrderedDict()¶
-
PersonContactForm.
media
¶
-
class
-
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>¶
-
-
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.
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.settings.
SHOOP_REGISTRATION_REQUIRES_ACTIVATION
= True¶ Require email-based activation for users?
This corresponds to using the default or simple django-registration backends.
-
class
shoop.front.apps.registration.views.
ActivationView
(**kwargs)[source]¶ Bases:
registration.backends.default.views.ActivationView
-
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.
RegistrationViewMixin
[source]¶ Bases:
object
-
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
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.
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.
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']}¶
-
required_installed_apps
= {'registration': 'django-registration-redux is required for user registration and activation'}¶
-
verbose_name
= 'Shoop Frontend - User Registration'¶
-
-
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']}¶
-
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
-
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 0x7fa5ccebe358>), ('sort', <django.forms.fields.CharField object at 0x7fa5ccebe7f0>)])¶
-
declared_fields
= OrderedDict([('q', <django.forms.fields.CharField object at 0x7fa5ccebe358>), ('sort', <django.forms.fields.CharField object at 0x7fa5ccebe7f0>)])¶
-
media
¶
-
-
class
shoop.front.apps.simple_search.views.
SearchView
(**kwargs)[source]¶ Bases:
django.views.generic.list.ListView
-
context_object_name
= 'products'¶
-
form_class
¶ alias of
SearchForm
-
model
¶ alias of
Product
-
template_name
= 'shoop/simple_search/search.jinja'¶
-
-
class
shoop.front.apps.simple_search.
SimpleSearchAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
label
= 'shoop_front.simple_search'¶
-
name
= 'shoop.front.apps.simple_search'¶
-
provides
= {'front_template_helper_namespace': ['shoop.front.apps.simple_search.template_helpers:TemplateHelpers'], 'front_urls': ['shoop.front.apps.simple_search.urls:urlpatterns']}¶
-
verbose_name
= 'Shoop Frontend - Simple Search'¶
-
-
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/v2.0.0/lib/python3.4/site-packages/shoop-2.0.0-py3.4.egg/shoop/front/basket/commands.py'>¶
-
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.
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.
-
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]¶
-
finalize
()[source]¶ Mark the basket as “completed” (i.e. an order is created/a conversion made).
This will also clear the basket’s data.
-
get_available_payment_methods
()[source]¶ Get available payment methods.
Return type: list[PaymentMethod]
-
get_available_shipping_methods
()[source]¶ Get available shipping methods.
Return type: list[ShippingMethod]
-
is_empty
¶
-
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;
ShoopFrontMiddleware
will usually take care of it.
-
total_weight
¶
-
-
class
shoop.front.basket.objects.
BasketLine
(source=None, **kwargs)[source]¶ Bases:
shoop.core.order_creator.source.SourceLine
-
can_change_quantity
¶
-
can_delete
¶
-
shop_product
¶ ShopProduct object of this line.
Return type: shoop.core.models.product_shops.ShopProduct
-
type
¶
-
-
class
shoop.front.basket.update_methods.
BasketUpdateMethods
(request, basket)[source]¶ Bases:
object
-
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.)
-
-
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
-
class
shoop.front.models.
StoredBasket
(id, key, shop, customer, orderer, creator, created_on, updated_on, persistent, deleted, finished, title, data, taxless_total_price_value, taxful_total_price_value, currency, prices_include_tax, product_count)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
StoredBasket.
MultipleObjectsReturned
¶
-
StoredBasket.
creator
¶
-
StoredBasket.
customer
¶
-
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.
orderer
¶
-
StoredBasket.
products
¶
-
StoredBasket.
shop
¶
-
StoredBasket.
taxful_total_price
¶
-
StoredBasket.
taxless_total_price
¶
-
exception
-
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.urls.
get_url
(url, *args, **kwargs)[source]¶ Try to get the reversed URL for the given route name, args and kwargs.
If reverse resolution fails, returns None (instead of throwing an exception).
Parameters: - url (str) – URL name.
- args (Iterable[object]) – URL args
- kwargs (dict[str, object]) – URL kwargs
Returns: Reversed URL or None
Return type: str|None
-
shoop.front.template_helpers.urls.
has_url
(url, *args, **kwargs)[source]¶ Try to get the reversed URL for the given route name, args and kwargs and return a success flag.
Parameters: - url (str) – URL name.
- args (Iterable[object]) – URL args
- kwargs (dict[str, object]) – URL kwargs
Returns: Success flag
Return type:
-
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]¶
-
class
shoop.front.views.category.
CategoryView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
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 0x7fa5ccef10f0>), ('manufacturers', <django.forms.models.ModelMultipleChoiceField object at 0x7fa5ccef1ac8>)])¶
-
declared_fields
= OrderedDict([('sort', <django.forms.fields.CharField object at 0x7fa5ccef10f0>), ('manufacturers', <django.forms.models.ModelMultipleChoiceField object at 0x7fa5ccef1ac8>)])¶
-
media
¶
-
-
class
shoop.front.views.order.
OrderCompleteView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
context_object_name
= 'order'¶
-
model
¶ alias of
Order
-
template_name
= 'shoop/front/order/complete.jinja'¶
-
-
class
shoop.front.views.order.
OrderRequiresVerificationView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
model
¶ alias of
Order
-
template_name
= 'shoop/front/order/requires_verification.jinja'¶
-
-
class
shoop.front.views.payment.
ProcessPaymentView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
context_object_name
= 'order'¶
-
model
¶ alias of
Order
-
-
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 orAnonymousContact
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 aCompanyContact
whereasrequest.person
is aPersonContact
. request.basket
:shoop.front.basket.objects.BaseBasket
- Shopping basket in use.
-
class
shoop.front.notify_events.
OrderReceived
(**variable_values)[source]¶ Bases:
shoop.notify.base.Event
-
bindings
= {}¶
-
identifier
= 'order_received'¶
-
name
= 'Order Received'¶
-
variables
= {'order': <shoop.notify.base.Variable object at 0x7fa5c857aba8>, 'language': <shoop.notify.base.Variable object at 0x7fa5c857a048>, 'customer_email': <shoop.notify.base.Variable object at 0x7fa5c857afd0>, 'customer_phone': <shoop.notify.base.Variable object at 0x7fa5c857a940>}¶
-
-
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.settings.
SHOOP_FRONT_INSTALL_ERROR_HANDLERS
= True¶ Whether Shoop uses its own error handlers.
If this value is set to
False
django defaults are used or the ones specified insettings.ROOT_URLCONF
file.Setting this to
True
won’t override handlers specified insettings.ROOT_URLCONF
.Handled error cases are: 400, 403, 404, and 500
-
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']}¶
-
verbose_name
= 'Shoop Frontend'¶
-
-
class
shoop.notify.actions.email.
SendEmail
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
bindings
= {'fallback_language': <shoop.notify.base.Binding object at 0x7fa5c8a07518>, 'language': <shoop.notify.base.Binding object at 0x7fa5c8a07f98>, 'send_identifier': <shoop.notify.base.Binding object at 0x7fa5c8a077b8>, 'recipient': <shoop.notify.base.Binding object at 0x7fa5c8a074a8>}¶
-
execute
(context)[source]¶ Parameters: context (shoop.notify.script.Context) – Script Context
-
identifier
= 'send_email'¶
-
name
= 'Send Email'¶
-
template_fields
= {'body': <django.forms.fields.CharField object at 0x7fa5c8a07b38>, 'subject': <django.forms.fields.CharField object at 0x7fa5c8a07668>}¶
-
template_use
= <TemplateUse.MULTILINGUAL: 2>¶
-
variables
= {}¶
-
-
class
shoop.notify.actions.notification.
AddNotification
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
bindings
= {'recipient_type': <shoop.notify.base.Binding object at 0x7fa5c8a359e8>, 'priority': <shoop.notify.base.Binding object at 0x7fa5c8a356a0>, 'url': <shoop.notify.base.Binding object at 0x7fa5c8a35dd8>, 'recipient': <shoop.notify.base.Binding object at 0x7fa5c8a35208>, 'message': <shoop.notify.base.TemplatedBinding object at 0x7fa5c8a351d0>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fa5c8a35400>}¶
-
identifier
= 'add_notification'¶
-
name
= 'Add Notification'¶
-
variables
= {}¶
-
-
class
shoop.notify.actions.order.
AddOrderLogEntry
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
bindings
= {'order': <shoop.notify.base.Binding object at 0x7fa5c8a51ac8>, 'message': <shoop.notify.base.Binding object at 0x7fa5c8a51b38>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fa5c8a07b00>}¶
-
identifier
= 'add_order_log_entry'¶
-
name
= 'Add Order Log Entry'¶
-
variables
= {}¶
-
-
class
shoop.notify.actions.
AddNotification
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
bindings
= {'recipient_type': <shoop.notify.base.Binding object at 0x7fa5c8a359e8>, 'priority': <shoop.notify.base.Binding object at 0x7fa5c8a356a0>, 'url': <shoop.notify.base.Binding object at 0x7fa5c8a35dd8>, 'recipient': <shoop.notify.base.Binding object at 0x7fa5c8a35208>, 'message': <shoop.notify.base.TemplatedBinding object at 0x7fa5c8a351d0>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fa5c8a35400>}¶
-
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 0x7fa5c8a51ac8>, 'message': <shoop.notify.base.Binding object at 0x7fa5c8a51b38>, 'message_identifier': <shoop.notify.base.Binding object at 0x7fa5c8a07b00>}¶
-
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
= {'fallback_language': <shoop.notify.base.Binding object at 0x7fa5c8a07518>, 'language': <shoop.notify.base.Binding object at 0x7fa5c8a07f98>, 'send_identifier': <shoop.notify.base.Binding object at 0x7fa5c8a077b8>, 'recipient': <shoop.notify.base.Binding object at 0x7fa5c8a074a8>}¶
-
execute
(context)[source]¶ Parameters: context (shoop.notify.script.Context) – Script Context
-
identifier
= 'send_email'¶
-
name
= 'Send Email'¶
-
template_fields
= {'body': <django.forms.fields.CharField object at 0x7fa5c8a07b38>, 'subject': <django.forms.fields.CharField object at 0x7fa5c8a07668>}¶
-
template_use
= <TemplateUse.MULTILINGUAL: 2>¶
-
variables
= {}¶
-
-
class
shoop.notify.admin_module.views.editor.
EditScriptContentView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
context_object_name
= 'script'¶
-
model
¶ alias of
Script
-
template_name
= 'notify/admin/script_content_editor.jinja'¶
-
-
class
shoop.notify.admin_module.views.list.
ScriptListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5c958f8d0>, <shoop.admin.utils.picotable.Column object at 0x7fa5c958f7f0>, <shoop.admin.utils.picotable.Column object at 0x7fa5c958f2e8>]¶
-
model
¶ alias of
Script
-
-
class
shoop.notify.admin_module.views.
ScriptEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
-
context_object_name
= 'script'¶
-
form_class
¶ alias of
ScriptForm
-
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'¶
-
model
¶ alias of
Script
-
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 0x7fa5c958f8d0>, <shoop.admin.utils.picotable.Column object at 0x7fa5c958f7f0>, <shoop.admin.utils.picotable.Column object at 0x7fa5c958f2e8>]¶
-
model
¶ alias of
Script
-
-
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 0x7fa5c8a51080>), ('name', <django.forms.fields.CharField object at 0x7fa5cbece7b8>), ('enabled', <django.forms.fields.BooleanField object at 0x7fa5c8b2eac8>)])¶
-
ScriptForm.
declared_fields
= OrderedDict([('event_identifier', <django.forms.fields.ChoiceField object at 0x7fa5c8a51080>), ('name', <django.forms.fields.CharField object at 0x7fa5cbece7b8>), ('enabled', <django.forms.fields.BooleanField object at 0x7fa5c8b2eac8>)])¶
-
ScriptForm.
media
¶
-
class
-
class
shoop.notify.admin_module.
NotifyAdminModule
[source]¶ Bases:
shoop.admin.base.AdminModule
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
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'¶
-
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'¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.simple.
Empty
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Condition
-
bindings
= {'v': <shoop.notify.base.Binding object at 0x7fa5c8a35438>}¶
-
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'empty'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.simple.
NonEmpty
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Condition
-
bindings
= {'v': <shoop.notify.base.Binding object at 0x7fa5c947a7f0>}¶
-
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'non_empty'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.
BooleanEqual
(data, validate=True)¶ Bases:
shoop.notify.conditions.simple.BaseEqual
-
bindings
= {'v2': <shoop.notify.base.Binding object at 0x7fa5c997f710>, 'v1': <shoop.notify.base.Binding object at 0x7fa5c997f6a0>}¶
-
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 0x7fa5c8a35438>}¶
-
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'empty'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.
IntegerEqual
(data, validate=True)¶ Bases:
shoop.notify.conditions.simple.BaseEqual
-
bindings
= {'v2': <shoop.notify.base.Binding object at 0x7fa5c997f5f8>, 'v1': <shoop.notify.base.Binding object at 0x7fa5c997feb8>}¶
-
identifier
= 'integer_equal'¶
-
name
= 'Integer Equal'¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.
LanguageEqual
(data, validate=True)¶ Bases:
shoop.notify.conditions.simple.CaseInsensitiveStringEqual
-
bindings
= {'v2': <shoop.notify.base.Binding object at 0x7fa5c997f860>, 'v1': <shoop.notify.base.Binding object at 0x7fa5c997fac8>}¶
-
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 0x7fa5c947a7f0>}¶
-
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'non_empty'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.
TextEqual
(data, validate=True)¶ Bases:
shoop.notify.conditions.simple.CaseInsensitiveStringEqual
-
bindings
= {'v2': <shoop.notify.base.Binding object at 0x7fa5c997fc50>, 'v1': <shoop.notify.base.Binding object at 0x7fa5c997fa58>}¶
-
identifier
= 'text_equal'¶
-
name
= 'Text Equal'¶
-
variables
= {}¶
-
-
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
¶
-
exception
Notification.
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.
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.
url
¶
-
exception
-
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
¶
-
exception
Script.
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.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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
¶
-
exception
Notification.
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.
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.
url
¶
-
exception
-
class
shoop.notify.models.
Script
(id, event_identifier, identifier, created_on, name, enabled, _step_data)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Script.
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.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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
= {}¶
-
description
= None¶
-
identifier
= None¶
-
name
= None¶
-
provide_category
= None¶
-
variables
= {}¶
-
-
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
¶
-
-
class
shoop.notify.base.
Condition
(data, validate=True)[source]¶ Bases:
shoop.notify.base.ScriptItem
-
bindings
= {}¶
-
identifier
= 'condition'¶
-
name
= 'Condition'¶
-
provide_category
= 'notify_condition'¶
-
variables
= {}¶
-
-
class
shoop.notify.base.
Event
(**variable_values)[source]¶ Bases:
shoop.notify.base.Base
-
bindings
= {}¶
-
identifier
= None¶
-
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'¶
-
variables
= {}¶
-
-
class
shoop.notify.base.
ScriptItem
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Base
-
bindings
= {}¶
-
get_value
(context, binding_name)[source]¶ Get the actual value of a binding from the given script context.
Parameters: - context (shoop.notify.script.Context) – Script Context
- binding_name (str) – Binding name.
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¶
-
variables
= {}¶
-
-
class
shoop.notify.base.
TemplatedBinding
(*args, **kwargs)[source]¶ Bases:
shoop.notify.base.Binding
-
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:
-
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
-
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
¶
-
-
class
shoop.notify.template.
Template
(context, data)[source]¶ Bases:
object
-
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: Raises: Whatever Jinja2 might happen to raise
-
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
-
identifier
= 'decimal'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.notify.typology.
Email
[source]¶ Bases:
shoop.notify.typology._String
-
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¶
-
identifier
= 'enum'¶
-
name
¶
-
-
class
shoop.notify.typology.
Integer
[source]¶ Bases:
shoop.notify.typology._Number
-
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_model
()[source]¶ Return type: django.db.models.Model
-
identifier
= 'model'¶
-
model_label
= None¶
-
name
¶
-
-
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'¶
-
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¶
-
name
= None¶
-
-
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
¶
-
-
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:
-
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
-
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
¶
-
-
class
shoop.notify.
Condition
(data, validate=True)[source]¶ Bases:
shoop.notify.base.ScriptItem
-
bindings
= {}¶
-
identifier
= 'condition'¶
-
name
= 'Condition'¶
-
provide_category
= 'notify_condition'¶
-
variables
= {}¶
-
-
class
shoop.simple_cms.admin_module.views.
PageEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
-
add_form_errors_as_messages
= True¶
-
context_object_name
= 'page'¶
-
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 0x7fa5c8a78da0>), ('url', <django.forms.fields.CharField object at 0x7fa5c9532978>), ('content', <django.forms.fields.CharField object at 0x7fa5c95322e8>), ('available_from', <django.forms.fields.DateTimeField object at 0x7fa5c8b93ba8>), ('available_to', <django.forms.fields.DateTimeField object at 0x7fa5c8b93908>), ('identifier', <django.forms.fields.CharField object at 0x7fa5c9532550>), ('visible_in_menu', <django.forms.fields.BooleanField object at 0x7fa5c9532668>)])¶
-
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 0x7fa5c8b93ba8>), ('available_to', <django.forms.fields.DateTimeField object at 0x7fa5c8b93908>), ('title', <django.forms.fields.CharField object at 0x7fa5c8a78da0>), ('url', <django.forms.fields.CharField object at 0x7fa5c9532978>), ('content', <django.forms.fields.CharField object at 0x7fa5c95322e8>)])¶
-
PageForm.
is_url_valid
(language_code, field_name, url)[source]¶ Ensure URL given is unique.
Check through the pages translation model objects to make sure that the url given doesn’t already exist.
Possible failure cases: for new page: * URL already exists
for existing page: * URL (other than owned by existing page) exists * URL exists in other languages of existing page
-
PageForm.
media
¶
-
class
-
class
shoop.simple_cms.admin_module.views.
PageListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7fa5c9532320>, <shoop.admin.utils.picotable.Column object at 0x7fa5c9532518>, <shoop.admin.utils.picotable.Column object at 0x7fa5c95329b0>, <shoop.admin.utils.picotable.Column object at 0x7fa5c9532be0>, <shoop.admin.utils.picotable.Column object at 0x7fa5c94c4b38>]¶
-
model
¶ alias of
Page
-
-
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
¶
-
exception
Page.
MultipleObjectsReturned
¶
-
Page.
content
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Page.
created_by
¶
-
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.
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.
-
exception
-
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
¶
-
PageTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
PageTranslation.
master
¶
-
PageTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
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:
Page is not found: raise Http404() like django would
No translation in active language for the page: raise Http404()
- Translation was found for active language, but the url doesn’t match given url:
return HttpResponseRedirect to the active languages url
If none of the upper matches: render page normally
-
model
¶ alias of
Page
-
slug_field
= 'translations__url'¶
-
slug_url_kwarg
= 'url'¶
-
template_name
= 'shoop/simple_cms/page.jinja'¶
-
-
class
shoop.simple_cms.
AppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
label
= 'shoop_simple_cms'¶
-
name
= 'shoop.simple_cms'¶
-
provides
= {'front_template_helper_namespace': ['shoop.simple_cms.template_helpers:SimpleCMSTemplateHelpers'], 'admin_module': ['shoop.simple_cms.admin_module:SimpleCMSAdminModule'], 'front_urls_post': ['shoop.simple_cms.urls:urlpatterns']}¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.simple_pricing.models.
SimpleProductPrice
(id, product, shop, group, price_value)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
SimpleProductPrice.
MultipleObjectsReturned
¶
-
SimpleProductPrice.
group
¶
-
SimpleProductPrice.
objects
= <django.db.models.manager.Manager object>¶
-
SimpleProductPrice.
price
¶ Property for Price object.
Similar to MoneyProperty but also has
includes_tax
field.Operaters with TaxfulPrice and TaxlessPrice objects.
-
SimpleProductPrice.
product
¶
-
SimpleProductPrice.
shop
¶
-
exception
-
class
shoop.simple_pricing.module.
SimplePricingContext
(**kwargs)[source]¶ Bases:
shoop.core.pricing.PricingContext
-
REQUIRED_VALUES
= ('customer_group_ids', 'shop')¶
-
customer_group_ids
= ()¶
-
shop
= None¶
-
-
class
shoop.simple_pricing.module.
SimplePricingModule
[source]¶ Bases:
shoop.core.pricing.PricingModule
-
identifier
= 'simple_pricing'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
pricing_context_class
¶ alias of
SimplePricingContext
-
-
shoop.simple_pricing.settings.
SHOOP_SIMPLE_PRICING_TAXFUL_DECIMALS
= 2¶ TODO: Document SHOOP_SIMPLE_PRICING_TAXFUL_DECIMALS
-
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'¶
-
-
class
shoop.simple_supplier.models.
StockAdjustment
(id, product, supplier, created_on, created_by, delta)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
StockAdjustment.
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
¶
-
exception
-
class
shoop.simple_supplier.models.
StockCount
(id, product, supplier, logical_count, physical_count)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
StockCount.
MultipleObjectsReturned
¶
-
StockCount.
objects
= <django.db.models.manager.Manager object>¶
-
StockCount.
product
¶
-
StockCount.
supplier
¶
-
exception
-
class
shoop.simple_supplier.module.
SimpleSupplierModule
(supplier, options)[source]¶ Bases:
shoop.core.suppliers.base.BaseSupplierModule
-
identifier
= 'simple_supplier'¶
-
name
= 'Simple Supplier'¶
-
-
class
shoop.testing.pseudo_payment.
PseudoPaymentMethodModule
(method, options)[source]¶ Bases:
shoop.core.methods.base.BasePaymentMethodModule
-
admin_detail_view_class
¶ alias of
ExampleDetailViewClass
-
identifier
= 'pseudo_payment'¶
-
name
= 'Shoop Pseudo Payment'¶
-
option_fields
= [('price', <django.forms.fields.DecimalField object at 0x7fa5ca50b390>), ('price_waiver_product_minimum', <django.forms.fields.DecimalField object at 0x7fa5ca520e48>), ('bg_color', <django.forms.fields.CharField object at 0x7fa5c9a7f048>), ('fg_color', <django.forms.fields.CharField object at 0x7fa5c962ecf8>)]¶
-
-
class
shoop.testing.
ShoopTestingAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
label
= 'shoop_testing'¶
-
name
= 'shoop.testing'¶
-
provides
= {'payment_method_module': ['shoop.testing.pseudo_payment:PseudoPaymentMethodModule'], 'admin_module': ['shoop.testing.admin_module:TestingAdminModule']}¶
-
verbose_name
= 'Shoop Testing & Demo Utilities'¶
-
-
class
shoop.utils.analog.
BaseLogEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
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
¶
-
-
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
-
exception
shoop.utils.excs.
Problem
(message, title=None)[source]¶ Bases:
Exception
User-visible exception
-
message
¶
-
-
shoop.utils.excs.
extract_messages
(obj_list)[source]¶ Extract “messages” from a list of exceptions or other objects.
For ValidationErrors, messages are flattened into the output. For Exceptions, args[0] is added into the output. For other objects, force_text is called.
Parameters: obj_list (Iterable[object]) – List of exceptions etc. Return type: Iterable[str]
-
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”.
The empty string (and None) are handled as “no folder”, i.e. root folder.
Parameters: path (str|None) – Pathname or None Returns: Folder Return type: filer.models.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
-
class
shoop.utils.form_group.
FormDef
(name, form_class, required=True, kwargs=None)[source]¶ Bases:
object
-
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.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.iterables.
batch
(iterable, count)[source]¶ Yield batches of count items from the given iterable.
>>> for x in batch([1, 2, 3, 4, 5, 6, 7], 3): >>> print(x) [1, 2, 3] [4, 5, 6] [7]
Parameters: - iterable (Iterable) – An iterable
- count (int) – Number of items per batch. If <= 0, nothing is yielded.
Returns: Iterable of lists of items
Return type: Iterable[list[object]]
-
shoop.utils.iterables.
first
(iterable, default=None)[source]¶ Get the first item from the iterable, if possible, or return default.
The iterable is, naturally, iterated for one value.
Parameters: - iterable (Iterable) – An iterable.
- default (object) – Default value
Returns: The first item from the iterable, or default
Return type:
-
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
andTaxlessPrice
are subclasses ofUnitedDecimal
.-
new
(value)[source]¶ Create new instance with given value using same unit as self.
Post-condition: If
x = y.new(v)
, thenx.unit_matches_with(y) and x.value == v
.Returns: Object with same type as self and matching unit, but with given decimal value Return type: UnitedDecimal
-
value
¶ Value of this decimal without the unit.
Return type: decimal.Decimal
-
-
exception
shoop.utils.numbers.
UnitMixupError
(obj1, obj2, msg='Unit mixup')[source]¶ Bases:
TypeError
Invoked operation for UnitedDecimal and object with non-matching unit.
The objects involved are stored in instance variables obj1 and obj2. Former is instance of
UnitedDecimal
or its subclass and the other could be any object.Variables: - obj1 (UnitedDecimal) – Involved object 1
- obj2 (Any) – Involved object 2
-
shoop.utils.numbers.
strip_non_float_chars
(s)[source]¶ Strips characters that aren’t part of normal floats.
-
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.
By default, iterables within the iterable are also compacted.
Parameters: 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: Return type: 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.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: Returns: A flattened string
Return type:
-
shoop.utils.text.
identifierify
(value, sep='_')[source]¶ Identifierify the given text (keep only alphanumerics and the given separator(s).
Parameters: Returns: An identifierified string
Return type:
-
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.translation.
cache_translations
(objects, languages=None, meta=None)[source]¶ Cache translation objects in given languages to the objects in one fell swoop. This will iterate a queryset, if one is passed!
Parameters: - objects – List or queryset of Translatable models
- languages – Iterable of languages to fetch. In addition, all “_current_language”s will be fetched
Returns: objects
Submodules¶
shoop.version module¶
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()