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
.
Change History¶
Shoop Release Notes¶
Shoop 4.0.0 Release Notes¶
Released on 2016-06-29 21:30 +0300.
This release includes many new features, bug fixes and improvements in over 400 non-merge commits since 3.0.0. Highlights of the changes are listed here, but for complete list of changes see Shoop Change Log or Git commit log.
This is also the last release of Shoop, since the product name will change to Shuup. The same code base with “shoop” replaced by “shuup” will be released as Shuup 0.4 shortly after Shoop 4.0 release.
There’s also update instructions for updating from 3.0.
New Features¶
- Campaigns
- Campaigns and coupons can now be managed in Admin
- Order printouts
- Allows creating PDF printouts of orders from Admin
- Requires WeasyPrint to be installed (available via pip)
- Stock management
- Stock counts can now be managed with Simple Supplier module
- Payments and refunds
- Payments and refunds for orders may now be created in Admin
- Order editing
- Non-delivered orders without payments may now be edited in Admin
- Package products
- Package products can now be created in Admin
- Shipping and payment behavior components
- Shipping and payment methods management is reformed to allow versatile extension with addons. One of the changes introduces a new concept called service behavior components. These components allow merchants to customize behavior of the payment and shipping methods in more detail than before.
- Price display options
- It is now possible to define how prices are rendered for a customer by a contact group setting. Choices are: show prices including taxes, excluding taxes or hide prices.
- Guide
- Guide app integrates search results from Shoop Guide documentation into Admin search
Miscellaneous¶
- Brazilian Portuguese translations (pt_BR)
- Thanks to Christian and Jonathan Hess
- Initialize checkout addresses from customer data
- Thanks to Jason Sujjon
Updating from 3.0¶
Shoop 4.0 introduces many API changes which could affect projects or addons based on Shoop 3.0. Here is a list of the API changes and instructions how to update your code.
Database changes
Database migration from 3.0.0 should go smoothly with MySQL and SQLite databases. Unfortunately we don’t test with PostgreSQL currently and found out just before the release that our migrations don’t work for PostgreSQL. Setting
connection.features.can_rollback_ddl
toFalse
(e.g. in yourmanage.py
) may help in that case.Payment and shipping service API is refactored
- This affects payment and shipping method addons.
- See Services API document for introduction to the new API.
- See this
pull request
as an example how to refactor the addon code.
Simple Pricing is renamed to Customer Group Pricing.
- Prices have to be migrated manually.
Enum value
OrderLineType.CAMPAIGN
is renamed toDISCOUNT
- Replace usages of
CAMPAIGN
line types withDISCOUNT
- Replace usages of
Discount Pricing is removed.
- Use the new Campaigns features instead.
order_creator_finished
signal is moved from Front to Core- Update your imports.
Shoop 3.0.0 Release Notes¶
Released on 2016-01-21 11:15 +0200.
Here’s a few highlights of new features, improvements and fixes in Shoop 3.0.0 since 2.0.0. For complete list of changes see Shoop Change Log or Git commit log.
There’s also update instructions for updating from 2.0.
New Features¶
- Creating orders from the Admin
- Localization
- Provide tools for collecting and compiling translated messages.
- Add language chooser to Classic Gray theme.
- Implement JavaScript translations.
- Xtheme plugins are now translatable.
- More messages have been marked for translation.
- Included translations: English, Finnish, Chinese and Japanese.
Improvements¶
- Allow addons to inject resources to Xtheme templates
- Enable email login and password recovery with username
- Show product media at order history and product detail pages
- Show Shoop version number in Admin
- Xtheme editor improvements
- Tax system improvements
- Document the tax system (see Prices and Taxes in Shoop)
- Implement override groups for Default Tax
- Clean-up internal tax/price related APIs
- And many more
Fixes¶
- Xtheme: Don’t crash when trying to revert unsaved configuration
- Default Tax: Fix calculation of added and compounded taxes
- And many more
Miscellaneous¶
- Test are now ran also on Travis
- Python package dependencies are updated and not so strict anymore
- Node package dependencies are locked down with npm-shrinkwrap
Updating from 2.0¶
Shoop 3.0 introduces some API changes which could affect projects or addons based on Shoop 2.0. Here is a list of the API changes and instructions how to update your code.
Priceful.total_price
has been removed. This affects e.g.OrderLine
,BasketLine
andPriceInfo
objects.- Use
Priceful.price
instead.
- Use
PriceTaxContext
is removed.- You should not need it. Use
PricingContext
orTaxingContext
where appropriate.
- You should not need it. Use
- Default Theme is removed.
- It is available as a separate package from https://github.com/shoopio/shoop-simple-theme
Address
is split toMutableAddress
andImmutableAddress
.Address
is converted to abstract base class.- Database changes should be handled by migrations.
- Usually usages of
Address
should be converted toMutableAddress
, but they should be converted to immutable withAddress.to_immutable
for e.g.Order
addresses.
- Submodules of
shoop.core.pricing
are now private.- Use the API exposed by the
shoop.core.pricing
module’s__init__.py
. E.g. useshoop.core.pricing.PriceInfo
instead ofshoop.core.pricing.price_info.PriceInfo
.
- Use the API exposed by the
- Submodules of
shoop.core.order_creator
are now private.- Use the API exposed by the module’s
__init__.py
.
- Use the API exposed by the module’s
shoop.core.utils.reference
is removed.- Some submodules of
shoop.xtheme
are now private.- Use symbols directly from
shoop.xtheme
, e.g.shoop.xtheme.Theme
instead ofshoop.xtheme.theme.Theme
orshoop.xtheme.TemplatedPlugin
instead ofshoop.xtheme.plugins.TemplatedPlugin
.
- Use symbols directly from
- Submodules of
shoop.core.models
are now private.- Use the models or enums directly from the main package.
shoop.core.models.product_variation
is removed.- Relevant functions are now available as
Product
methods.
- Relevant functions are now available as
Shoop 2.0.0 Release Notes¶
Released on 2015-10-05 16:45 +0300.
The highlights of this release (over 500 commits since 1.2!) are:
- Revamp of the pricing and taxation systems for flexible international commerce
- A new pluggable frontend theming system called Xtheme
- Usability improvements for the admin, including much better media management
- A brand new, slick frontend theme “Classic Gray”
- Lots and lots of other fixes and improvements!
For more detailed list of changes see Shoop Change Log or Git commit log.
Shoop Change Log¶
Version 4.0.0¶
Released on 2016-06-29 21:30 +0300.
Core¶
- Fix bug: Category model is missing MPTT ordering options
- Add staff only behavior component
- Add refund-related methods to
Order
- Add
OrderLineType.REFUND
enum type - Update order phone max length to 64 characters
- Add cash payment method
- Add rounding behavior component
- Add contact group availability behavior component
- Fix bug: Do not display decimal values in scientific notation
- Fix bug: Taxes of child order lines are filled incorrectly
- Fix bug: Order line parent lines are not linked
- Add modified on for
Order
- Add modified by for
Order
andOrderSource
- Add
get_company_contact
toshoop.core.models
- Implement taxing of lines without tax class
- Add new abstract method
get_taxed_price
toTaxModule
- Add
ShopProduct.is_visible
- Add
Order.can_edit
- Update shipping status correctly in
Order.create_shipment
- Add
OrderModifier
for modifying orders withOrderSource
- Add option use
Order.create_shipment
with unsavedShipment
- Add identifier for
Shipment
- Fix bug: Fix max length for service method names for
Order
- Make
Order.create_payment
also do status update for partially paid - Add
get_total_unpaid_amount
method toOrder
- Add
is_canceled
andcan_set_canceled
toOrder
- Fix bug: Convert
Shipment
weight to kilograms - Make
create_shipment
for order atomic - Add
shipment_created
signal - Add
get_tracking_codes
toshoop.core.models.Order
- Add weight based pricing behavior component
- Add
total_gross_weight
property forSource
- Fix bug: Order line text is not set for package products
- Add new Service API and implement shipping and payments with it
- Remove BaseMethodModule based API (
shoop.core.methods
) - Add support for custom user model (
AUTH_USER_MODEL
) - Add management command to generate bought with relations
- Add
merchant_notes
text-field toContact
- Add
first_name
andlast_name
fields toPersonContact
- Add bought with relation to
ProductCrossSellType
- Set customer marketing permission while creating order
- Disable delete for default contact groups
- Allow storing price display options to contact groups
- Add template tags for rendering prices with context specific price display options (pretax or with taxes, or hide prices totally)
- Fix bug:
OrderSource.tax_amount
always returned zero price - Add contacts automatically to type specific default groups
OrderCreator
no longer requires a request- Add
order_creator_finished
signal underorder_creator
- Move calculate_taxes_automatically from
OrderSource
toTaxModule
- Add shop product validation for OrderSource
- Add option to create payments with REST API
- Add contact address for
Shop
- Add update_stock calls for
SimpleSupplierModule
- Rename
CAMPAIGN
inOrderLineType
enum toDISCOUNT
- Add
OrderSourceModifierModule
interface for modifying order source - Add
DiscountModule
interface for pricing - Simplify
PricingContext
and require shop and customer for it - Add
get_price_info
etc. functions toshoop.core.pricing
- Add
get_suppliable_products
toshoop.core.models.Supplier
- Add “codes” API to OrderSource and BaseBasket
Localization¶
- Add Brazilian Portuguese translations (pt_BR)
Admin¶
- Add refund creator to order admin
- Add customer detail view to order creator
- Define module-level permissions for all admin modules
- Enable adding of permission groups from users admin
- Add admin module for managing Django permission groups
- Add
get_required_permission
toAdminModule
- Add support for module-level permissions
- Use Select2MultipleField for handling contact members
- Add Select2MultipleField
- Add account manager for contact
- Add PersonContact choice widget
- Add barcode filter to product list view
- Show stock in order creator
- Fix bug: Fix decimal precision issues on order creation
- Enable order creation for contact from contact detail view
- Fix bug: Refresh order lines when customer is changed during order creation
- Add default
is_active
filter to Contact and User admins - Enable default values for
ChoiceFilter
- Enable contact activation/deactivation
- Allow contact adding and removing for company
- Show companies in person contact edit page
- Add target option to
SearchResult
- Filter contacts with group in contact list view
- Hide group members from contact group edit view
- Remove support for select pickers
- Enable multiselect dropdown with Select2
- Enable adding log entries to orders
- Enable order editing
- Allow shipment creation form extensions
- Add payment creation view to
Order
admin - Enable order cancelation in Order edit view
- Hide invalid choices for package products
- Fix bug: Fix convert to parent menu items in
EditProductToolbar
- Show tracking codes in order detail
- Fix bug: Show package siblings for variation children
- Fix bug: Detail page of contact with multiple groups fails on Python 3
- Enable add/edit for weight based behavior component through service admin
- Add
admin_contact_group_form_part
provider forContactGroup
admin - Redo shipping and payment method management
- Add service provider management
- Add package mode for products
- Enable merchant notes editing for contacts
- Add option to add extra form parts to Shop edit view
- Enable delete for contact groups
- Make all enabled shipping and payment methods available in order creator
- Check product quantities in order creation
- Add option to add action buttons to Order edit view
Addons¶
- Enable upgrade, migrations and collectstatic from admin
- Has a known problem in reloading application server.
Front¶
- Initialize checkout addresses from customer data
- Logout users linked to inactive contact
- Allow user to change password from account settings
- Add login check for inactive contacts
- Remove “Ordering for company” from checkout if logged in
- Allow user to link company contact from account page
- Log-in as company if user is a member of a company
- Make
get_product_cross_sells
faster - Make
get_best_selling_products
faster - Make
get_visible_products
faster - Fix bug with multiple service checkout phases
- Update UI for package products
- Add SHOOP_FRONT_ADDRESS_FIELD_PROPERTIES setting
- Support also django-registration-redux 1.4
- Enable description and logo for methods in checkout
- Add admin view for monitoring customer carts
- Remove
get_method_validation_errors
signal - Fix bug at
get_visible_products
filter when orderable_only is False - Set template price display options from the customer
- Fix bug: BasketStorage.finalize() never called delete() correctly
- Check product quantity already in basket while adding
- Move
order_creator_finished
signal under core - Add “next” parameter support for registration
- Process given coupon codes in basket
- Add
get_visible_products
template helper
Xtheme¶
- Add custom XThemeModelChoiceField to show admin URLs
- Enhance default text plugin editor to remarkable markdown editor
- Add support for global/multi-view placeholders
- Add generic snippets plugin for doing simple integrations
- Add a plugin for displaying category links on shop front
- Add a linkable image plugin
Classic Gray Theme¶
- Add Shoop Wishlist addon support for logged in users
- Hide product order section when prices are hidden
- Hide cart when prices are hidden
- Show tracking codes in order detail
- Remove
ProductCrossSellType.COMPUTED
from cross-sells plugin - Update cross-sells plugin to use
ProductCrossSellType.BOUGHT_WITH
- Render prices with the new price rendering template tags
- Show error messages while adding products to basket
- Add “next” parameter to register links
- Add Coupon use possibility to basket page
- Add option to only show orderable products to highlights plugin
- Add Xtheme plugin to display social media links on shop front
Simple Supplier¶
- Add admin modules for updating stock
- Add support for stock counts and values
Order Printouts¶
- Add app for creating PDF printouts of orders
- Currently supports printing of Order confirmation and Delivery slips
Campaigns¶
- Add campaigns app with following features:
- Campaigns management
- Coupon management
- Contact group sales ranges
Customer Group Pricing¶
- Rename Simple Pricing to Customer Group Pricing
- Fix pricing for
AnonymousContact
Discount Pricing¶
- Removed
Simple CMS¶
- Add option to list children on page
- Add possibility to set parent on page
Default Tax¶
- Filter tax rules by postal codes to gain better performance
- Add minimum and maximum postal code values to
TaxRule
Guide¶
- Add guide app that integrates help documentation into admin search
General/miscellaneous¶
- Rename UnitedDecimal to UnittedDecimal
- Add a way to find out min and max values from pattern
- Reword doc/provides.rst
Version 3.0.0¶
Released on 2016-01-21 11:15 +0200.
Core¶
- Document Shoop tax system
- API and documentation clean-up
- Remove
AddressManager
- Split address into mutable and immutable address
- Add Product.get_public_media helper function
- Ensure
TranslatabelShoopModel.__str__
doesn’t return lazy objects - Deny price unit changes of in-use
Shop
- Assign created customers to
CustomerTaxGroups
on creation - Fix couple tax related terms
- Remove
PriceTaxContext
- Add
PricingContextable
interface and fix related docstrings - Remove
Priceful.total_price
- Add dynamic configuration API:
shoop.configuration
- Fix tax calculations and implement override groups
- Add autoexpiring versioned cache API:
shoop.core.cache
- Enable email login and password recovery with username
Localization¶
- Add translations for Finnish, Chinese and Japanese
- Add translation extraction tools (
shoop_makemessages
) - Mark more messages for translation in templates
- Enable JavaScript translations
Admin¶
- Bump bootstrap-datetimepicker version to 2.3.8
- Show Shoop version number in Admin
- Fix order list sorting and filtering by total price
- Fix CMS page list sorting by title
- JavaScript compilation fixes: Turn our ES6 to ES5 with Babel
- Fix URL encoding in
redirect_to_login
- Add view for creating orders from the Admin
- Enable markdown editor for product and category description
- Fix SKU and name initialization when creating a product by search
- Add new template macros
- Refactor templates to use template macros
- Admin form styling and UX updates
Front¶
- Set default country in checkout address forms
- Fix SHOOP_FRONT_INSTALL_ERROR_HANDLERS setting being not respected
- Change password recover error message
Xtheme¶
- Make Xtheme plugins translatable
- Allow addons to inject resources
- Editor improvements
- Fix a crash when trying to revert unsaved configuration
Classic Gray Theme¶
- Basket: Hide line base price when it’s not positive
- Show product media at order history and product detail pages
- Add language changer to navigation
- Add possibility for other future brand colors
- Add carousel styles for Bootstrap carousel
- Unvendor fonts
- Show maintenance mode for super user
- Fix logo text line height
- Add new placeholders
- Footer CMS Pages field are no longer required
- Update label for footer links to avoid confusion
Default Theme¶
- Remove Default theme from Shoop Base. Moved to https://github.com/shoopio/shoop-simple-theme
Campaigns¶
- Fix admin list view sorting
General/miscellaneous¶
- Add Transifex configuration for the
tx
command - Add verbose names to all model and form fields
- Do unit testing from doctests too
- Update Python package dependencies
- Lock down JavaScript dependencies
- Code style improvements
- Add configuration for Travis CI
- Include JS and CSS source maps to the Python package
- Cleanup tax TODOs
- Move apply_request_middleware to testing
- Documentation: Tune Sphinx settings and ignore migrations in API docs
- Fix Eslint complaints
- Make sure that bower is ran non-interactively
Version 2.0.0¶
Released on 2015-10-05 16:45 +0300.
Admin¶
- Add basic Manufacturer views
- Basic Supplier management
- Add image field for category
- Fix issue with price not being saved
- Optionally disable creating shops
- Add “Product Media” tab to product editing
- Tabify translated fields
- Variation UI styles
- Media Browser Rehaul
- Add
ImageChoiceWidget
- Actually send
data-filter
to media browser from browse widgets - Admin form error indicators
- Add keyboard shortcuts to megasearch
- Show first language tab with errors
- Update styles for admin form error indicators
- Show errors more clearly
- Make folder clicks work at media browser
- Fix paths of generated source maps
- Add styles for bootstrap input-group
- Time interval attribute now renders as
DecimalField
- Notify: Add better error handling for “step edit”-popup
- Better variation error handling
- Fix issue where visibility errors caused an error
- Update admin category view
- Admin datetimepicker
Core¶
- Rework
SimplePricing
and pricing in general - Add non-ASCII support for supplier name
- Fix checking of duplicate settings
- Add new fields to shop core
- Add
DiscountPricingModule
- Fix PriceInfo usage with non-one quantities
- Fix shoop.core.migrations.0006
- Tax clean-up and refactoring
- Prevent
Shop
being deleted when image was deleted
Front¶
- An all-new dynamic theming system, Xtheme
- Classic Gray: A new slick theme built on the Xtheme system
- Add ordering for cross sells template helper
- Fix
get_root_categories
performance - Maintenance mode
- template_helpers: Fix get_pagination_variables
- Ensure user is logged in after activating account
- Customer URL now requires login
- Add support for Complex variations
- Add Default ErrorHandling
- Fix issue with variation children being listed for admin user
- Front: Fix issue with variation children visible in search results
General/miscellaneous¶
- Run ESLint on all the things!
- Prunes, manifests
- PEP8ify
- Various fixes
- Tests: Make test_user_detail_contact_seed not fail randomly
- Miscellaneous tiny fixes
- Fixes
- Cms duplicate
- Embetter patterns
- Saner sanity tools
- Workbench: Allow overriding couple settings from env
Version 1.2.0¶
Released on 2015-08-24 17:30 +0300.
- Admin: Polyfill forms to ensure IE support
- Fix uniqueness of some InternalIdentifierFields
- Namely identifier field of Attribute, OrderStatus, ProductVariationVariable and ProductVariationVariableValue
- Admin: Show payment details in order views
- Coding Style: Clean-up and sort all imports
- Fix usages of too-direct imports of models
- Fix some unicode/bytes issues by adding “unicode_literals” imports
- Admin layout fixes
- Update telemetry admin layout and add translations tags
- Change the attributes icon from product edit to the right one
- Move attributes in product type edit to it’s own tab
- Hide browser native horizontal scrollbar from main menu
- Admin: Product image management
- Admin: Product Variation management
- Front: Add cross-sells to product detail page in default template
- Admin: Fix menu scrolling
- Upgrade Python and npm dependencies
- Admin: Shop management
- Front: Add link to admin panel in default template
- Admin: Fix product attributes getting cleared unless they were edited
- Admin: Product Sales Unit management
- Admin: Add ProductChoiceWidget for selecting Products
- Admin: Product cross-sell management
- Admin: Styling: Add borders to bootstrap select
- Admin: Fix showing details of a CompanyContact
- Admin: Fix showing current addresses in contact details
Version 1.1.0¶
Released on 2015-07-03 12:30 +0300.
- Improve “Getting Started with Shoop Development” documentation
- Add a basic REST API for reading/writing products and reading orders
- Use the database to store shopping baskets by default
- Implement pluggable shopping basket storage backends
- Implement basic contact group admin
- Add telemetry (usage statistics) system
- Add Dockerfile
- Improve admin login flow
- Document settings; make documentation builds available on ReadTheDocs
- Make release packaging much more robust
- Generate order keys in a secure manner
- Trim admin search strings
- Embetter admin order layouts
- Create the Shop as active with
shoop_init
management command - Fix usages of
Category.get_ancestors()
in templates - Remove Stripe integration (shoop.stripe)
- It now lives in https://github.com/shoopio/shoop-stripe
- Core: Declare correct
required_installed_apps
in AppConfig - Fix handling of tuple-format
required_installed_apps
- Fix Money class to not read settings at instance creation
- Fix management command
shoop_show_settings
for Python 3 - Add Addon documentation (doc/addons.rst)
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
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.
Prices and Taxes in Shoop¶
This document gives an overview of Shoop’s pricing and tax mechanics. For deeper view about the implementation – for example, if you’re implementing a price/tax related addon – also read the Implementation of Prices and Taxes in Shoop document.
Price Unit¶
Prices in Shoop have an unit that is combination of a currency and an
includes/excludes taxes flag. That is, prices may be specified pretax
or with taxes included. Which taxation type and currency is used is
usually decided by the Shop
, which has currency
and prices_include_tax
fields. In general, it is also possible that
the active PricingModule
uses a different price
unit that is specified by the shop. Currently there is no such pricing
module in the Shoop Base distribution.
Different price units cannot be mixed: Adding a pretax price and a price including taxes together would be an error, as would be adding USDs to EURs.
The price unit of a Shop
can be changed as long as
there are no Orders
created for the shop.
The price unit of an Order
is stored in its
currency
and prices_include_tax
fields. The line prices of an
order are stored in that unit, but the total price of order is stored
with and without taxes in the taxful_price
and taxless_price
fields.
Calculation of Taxes¶
How Taxes Are Determined¶
Taxes in Shoop are implemented by a tax module
. The Shoop Base distribution ships a tax
module called Default Tax, but it is
possible to plug in another tax module via addons or to
implement a new one.
The responsibilities of a tax module are to calculate taxes for an order or for separate items (e.g. product, shipping or some other taxable item). The most important function of a tax module is to take an order source (such as a basket), which has lines (with pre-tax prices or prices with tax included) and fill in the taxes for each line in the source.
When Taxes Are Determined¶
There are two modes of operation for calculating the taxes: on-demand
and on-checkout. If current tax module declares that tax calculation is
“cheap” (does not cost a transaction fee and is fast to compute) and
SHOOP_CALCULATE_TAXES_AUTOMATICALLY_IF_POSSIBLE
setting is true, then on-demand calculation will be used. Otherwise
on-checkout calculation will be used.
With on-checkout tax calculation mode Shoop calculates taxes for a basket in the confirmation phase of the checkout process or in the confirmation phase of the order creating UI in the Shop Admin. This means that taxes are not known for items in the basket, product listings or on the detail page of a product. The reason for not calculating taxes before the confirm phase is that the active tax module might query tax information from an external source which might be prohibitively slow or cost a transaction fee.
With on-demand tax calculation mode calculation happens when showing prices in the shop, if prices returned by the current pricing module are pretax and current price display options demand prices including taxes or the other way around.
Taxes in Orders¶
Taxes are stored in order lines. Each order line can have several taxes
applied and each of them is stored to a separate line tax
object linked to the order line.
These line tax objects contain references to Tax
objects, the name of the tax, the applied amount and the base amount the
tax is calculated off of.
The Default Tax Module¶
Shoop Default Tax is a tax module that calculates taxes based on a set of static rules stored in the database. A tax rule applies a tax for an order line or any other taxable item (e.g. product or shipping method). An item can be taxed with several taxes, which will be either added together or compounded over each other.
Defining Tax Rules for The Default Tax Module¶
The tax rules of Default Tax can be managed in the Shoop Shop Admin (Menu → Taxes → Tax Rules).
Most fields of the tax rule determine the conditions when the rule applies. All non-empty fields must match for the rule to apply. Empty fields are not considered, e.g. if the “Customer tax groups” field is left empty, all customer tax groups will match. You may use these conditions to apply tax rules e.g. only for a specific country or area.
Area specific matching criteria fields are specified with a pattern that is able to match multiple values. See the help text in the admin view for details on how to write those patterns.
If all conditions of a tax rule match, the rule will be applied. That means that the tax specified in the rule will be added for the item. If there are several rules to be applied for an item, the total tax is determined by the priority field. Rules with same priorities are calculated as added (which would be the case for taxes in the United States) while rules with different priorities define compounding taxes (for example the PST taxes in Canada’s Quebec province).
Tax rules may also define override group numbers. If several rules match, only the rules with the highest override group number will be effective. This can be used, for example, to implement tax exemption by adding a rule with very high override group number that sets a zero tax.
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
Collecting translatable messages¶
To update the PO catalog files which contain translatable (and
translated) messages, issue shoop_makemessages
management command in
the shoop
directory:
cd shoop && python -m shoop_workbench shoop_makemessages
Docstring coverage¶
The DocCov script is included for calculating some documentation coverage metrics.
python _misc/doccov.py shoop/core -o doccov.html
Development Tools¶
Sanity Checker¶
The check_sanity.py
tool does basic text file sanity checking on the
codebase.
python _misc/check_sanity.py
DocCov¶
The doccov.py
tool checks for docstring coverage and docstring style.
python _misc/doccov.py -o report.html shoop
Ensure Code Style¶
The ensure_code_style.py
tool has a couple checkers:
- one that checks that all
ForeignKey``s are declared with ``on_delete
clauses - one that checks that model and form fields have properly translatable verbose names
python _misc/ensure_code_style.py shoop
Ensure License Headers¶
The ensure_license_headers.py
tool checks that all source files have the requisite
license header. It can also optionally write the headers to the files by itself.
python _misc/ensure_license_headers.py shoop
# or to write changes:
python _misc/ensure_license_headers.py -w shoop
Ensure Unicode Literals¶
The ensure_unicode_literals.py
tool checks that all Python files have the
from __future import unicode_literals
statement, to improve Python 2 compatibility.
It can also optionally add these statements itself.
python _misc/ensure_unicode_literals.py shoop
# or to write changes:
python _misc/ensure_unicode_literals.py -w shoop
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.
The provide categories used by Shoop are listed in Provide Categories but you can also define your own categories as you wish.
Todo
Document the various ways better.
Provides are grouped under different categories, such as admin_module
,
xtheme_plugin
, 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 = {
'service_provider_admin_form': [
'pigeon.admin_forms:PigeonShippingAdminForm',
],
}
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¶
Core¶
admin_category_form_part
- Additional
FormPart
classes for Category editing. admin_contact_form_part
- Additional
FormPart
classes for Contact editing. admin_contact_group_form_part
- Additional
FormPart
classes for ContactGroup editing admin_extend_create_shipment_form
- Allows providing extension for shipment creation in admin.
Should implement the
ShipmentFormModifier
interface. admin_product_form_part
- Additional
FormPart
classes for Product editing. (This is used by pricing modules, for instance.) admin_shop_form_part
- Additional
FormPart
classes for Shop editing. admin_module
- Admin module classes. Practically all of the functionality in the admin is built via admin modules.
discount_module
DiscountModule
for pricing system.front_service_checkout_phase_provider
- Allows providing a custom checkout phase for a service (e.g. payment
method or shipping method). Should implement the
ServiceCheckoutPhaseProvider
interface. front_template_helper_namespace
- Additional namespaces to install in the
shoop
“package” within template contexts. .. seealso:: Custom Template Helper Functions admin_order_toolbar_button
- Additional
BaseActionButton
subclasses for Order detail. Subclass init should take current order as a parameter. admin_order_section
- Additional
OrderSection
subclasses for Order detail sections. 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. order_source_modifier_module
OrderSourceModifierModule
for modifying order source, e.g. in itsget_final_lines
.pricing_module
- Pricing module classes; the pricing module in use is set with the
SHOOP_PRICING_MODULE
setting. service_behavior_component_form
- Forms for creating service behavior components in Shop Admin. When
creating a custom
service behavior component
, provide a form for it via this provide. service_provider_admin_form
- Forms for creating service providers in Shop Admin. When creating a
custom
service provider
(e.g.carrier
orpayment processor
), provide a form for it via this provide. supplier_module
- Supplier module classes (deriving from
BaseSupplierModule
), as used bySupplier
. 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).
xtheme_resource_injection
- XTheme resources injection function that takes current context and content as parameters.
Campaigns Provide Categories¶
campaign_catalog_filter
- Filters that filter product catalog queryset to find the matching campaigns.
campaign_context_condition
- Context Conditions that matches against the current context in shop to see if campaign matches.
campaign_product_discount_effect_form
- Form for handling product discount effects of a catalog campaign.
Should be a ModelForm with its model being a subclass of
ProductDiscountEffect
. campaign_basket_condition
- Conditions that matches against the order source or source lines in basket.
campaign_basket_discount_effect_form
- Form for handling discount effects of a basket campaign. Should be
a ModelForm with its model being a subclass of
BasketDiscountEffect
. campaign_basket_line_effect_form
- Form for handling line effects of a basket campaign. Should be a
ModelForm with its model being a subclass of
BasketLineEffect
.
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.customer_group_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.customer_group_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.)
Implementation of Prices and Taxes in Shoop¶
This document describes deeper details about price and tax implementation in Shoop from a developer’s point of view. To understand the basics, please read Prices and Taxes in Shoop first.
Types Used for Prices and Taxes¶
Used to represent money amounts (that are not prices). It is basically aDecimal
number with a currency.
Used to represent prices.
Price
is aMoney
with anincludes_tax
property. It has has two subclasses:TaxfulPrice
andTaxlessPrice
.There should usually be no need to create prices directly with these classes; see Creating Prices.
An interface for accessing the price information of a product, order line, basket line, or whatever. See Accessing Prices of Product or Line.
A class for describing an item’s price information.
An interface for querying prices of products.
A container for variables that affect pricing. Pricing modules may subclass this.
An interface for objects that can be converted to a pricing context. Instances ofPricingContext
orHttpRequest
satisfy this interface.
An interface for describing a calculated tax of a line in order or basket. Has a reference to the line and to the applied tax and the calculated amount of tax. One line could have several taxes applied, each is presented with a separateLineTax
.
A Django model for persistently storing the calculated tax of anOrderLine
. Implements theLineTax
interface.
A Django model for a tax with name, code, and percentage rate or fixed amount. Fixed amounts are not yet supported.
Todo
Fix this when fixed amounts are supported.
An interface for items that can be taxed. Implemented byProduct
,ShippingMethod
,PaymentMethod
andSourceLine
.
A Django model for a tax class. Taxable items (e.g. products, methods or lines) are grouped to tax classes to make it possible to have different taxation rules for different groups of items.
A Django model for grouping customers to make it possible to have different taxation rules for different groups of customers. Shoop assigns separateCustomerTaxGroup`s for a `~shoop.core.models.PersonContact
and aCompanyContact
by default.
An interface for calculating the taxes of anOrderSource
or anyTaxableItem
. The Shoop Base distribution ships a concrete implementation of aTaxModule
calledDefaultTaxModule
. It is a based on a table of tax rules (saved withTaxRule
model). See The Default Tax Module. UsedTaxModule
can be changed withSHOOP_TAX_MODULE
setting.
A type to represent the return value of tax calculation. Contains a pair of prices,TaxfulPrice
andTaxlessPrice
, of which one is the original price before the calculation and the other is the calculated price. Also contains a list of the applied taxes.TaxedPrice
is the return type ofget_taxed_price_for
method in theTaxModule
interface.
A container for variables that affect taxing, such as customer tax group, customer tax number, location (country, postal code, etc.). Used in theTaxModule
interface. Note: This is not usually subclassed.
Creating Prices¶
When implementing a PricingModule
or another
module that has to create prices, use the Shop.create_price
method. It makes sure that all
prices have the same price unit.
Accessing Prices of Product or Line¶
There is a Priceful
interface for accessing
prices. It is implemented by OrderLine
and
SourceLine
,
BasketLine
, and
PriceInfo
which is returned e.g. by
get_price_info
method.
Services API¶
Shoop provides a service API which is based on polymorphic models.
Currently Shoop provides two implementations of these services: payment
methods
and shipping methods
, but the API allows implementing
other kind of services too.
From the Services API point of view a service
is something that may conditionally
generate some new lines
for a
basket. Also various aspects of these services can be customized:
Availability
of the service for certain basketCosts
of the service for certain basketEffective name
of the service for certain basket
Each service should have a service provider
and service choice
, which is selected from a list of
service choices specified by the service provider.
Behavior of a service can be customized with behavior components
. Each behavior component
may limit availability of the service, or (conditionally) add costs to
it, or affect service delivery time (which in case of shipping methods
is the shipping time, but could have other meaning for other kinds of
services). It is possible to assign several behavior components to a
service.
Notification Framework¶
The purpose of the notification framework is to be a generic, run-time configurable and code extensible system to inform interested parties about events in the store.
Events could include
- orders being created
- shipments being dispatched
- orders being canceled
- products reaching a given stock threshold
- a user requesting a password reset
et cetera.
Notifications may be delivered over different channels, such as email, SMS, phone or even instant messages, as delivery channels are also pluggable.
It is known that the notification framework partially overlaps the Django signal system as used in Shoop in scope. However Django signals are not user-configurable and their purpose is different.
Glossary¶
- Event - a class of notifiable event
- Event Variables - a set of typed variables pertaining to a given event
- Script - a configurable object describing the chain of system actions in response to an Event
- Script Context - a set of variables populated from the event variables before the script is begun
- Action - a configured action within a script, such as “Send email to x@y.local“
- Action Class - a type of action provided by an app (or built-in to the notification framework), such as “Send Email”
- Condition - a configured conditional enabling actions within a script, such as “If Order Contains Product XYZ-1”
- Condition Class - a type of condition provided by an app (or built-in to the notification framework), such as “If Order Contains Product”
- Template - a possibly multilingual set of textual templates attached to Actions that require configurable text.
- Attachment - a named, MIME-typed assumedly binary blob that may be delivered along a notification, such as a PDF order confirmation.
Events¶
An Event represents a single event that may occur in the system.
Events are registered through the Shoop Apps’ provides
mechanism and
must have unique identifiers (“event identifier”).
Events provide typed variables that may be utilized in script items, in either variable bindings or message templates.
In addition, a number of system variables are made available for all events.
For instance, an “Order Created” event could provide the variables
order
(type Order) - the order itselfcustomer_email
(type email) - the customer’s email address (extracted from the order)customer_phone
(type phone) - the customer’s phone number (extracted from the order)payment_email
(type email) - the payment email address (extracted from the order)shipment_email
(type email) - the shipment email address (extracted from the order)language
(type language) - the customer’s preferred language (extracted from the order)
and a default script that sends a pre-defined text template to the customer email.
A “Password Reset” event could provide the variables
user
(type User) - the requesting useruser_email
(type email) - the email address of the userpassword_reset_url
(type URL) - the URL for resetting the password.
Scripts¶
Event scripts define the rules, i.e. conditions and actions defining what to do when a notification event occurs. A single event may have multiple scripts attached; all of them are executed if they are enabled.
A script may be as simple as “Always -> Send Email -> Stop”, or it may have conditions that send emails with different templates depending on the language of the order, or products contained within the order.
Events may provide a script template, which can be loaded for further configuration by the shop administrator. No scripts are loaded by default, though. If no scripts exist for an event, nothing is done when the event occurs.
The model for scripts is a “routing table” with steps of the form “Conditions / Actions / Next”. This is somewhat modeled after uWSGI’s Internal Routing system. Note: This would be easy to upgrade to a full-fledged flowchart/data-flow programming environment akin to Unreal Engine 4’s Blueprint Visual Scripting system.
The Conditions set for a script step may be joined with different conditional operators. Currently, “All”, “Any” and “None” are implemented. The actions for a single step are executed sequentially.
The actions for “Next” are “Continue” and “Stop”. (A “Goto” action is also possible, but it is not considered a requirement at present.) “Continue” will continue executing the routing table from the next step, and “Stop” will cease script execution.
The Condition and Action classes available for notification scripts are
also provided via the provides
mechanism; many actions are built-in
(provided by the notification framework itself), but may be extended by
other apps. Like Events, Condition classes and Action classes have
unique identifiers.
Conditions and Actions are configurable. The configurable variables are set by the Condition classes and Action classes, using the same typology as Event variables.
For instance, Conditional classes could include
- “Language Equals” (configured by a variable of type Language and a constant of type Language)
- “Order Contains Product SKU” (configured by a variable of type Order and a constant of type String)
- “Order Is Paid” (configured by a variable of type Order)
and Action classes might include
- “Send Plain-Text Email” (configured by variable/constant of type Email and a template (see below))
- “Send Text and HTML Email”
Extension Action classes for, say, integration might even contain
- “Send Order To External System XYZ”
The recipients, etc. for emails are configurable, making it possible to easily implement merchant order notifications using the same Actions and Conditions.
Templates¶
Most, if not all, actions require some sort of templating. The Jinja2 language is used for the templates. Templates may contain multiple sections, such as “Subject” or “Content”; these are set by the Action requesting an editable template, as the template editor is embedded in the Action’s configuration view.
An action may request multilingual templates. Multilingual templates duplicate each section for all languages set in the system configuration. (The sending Action is naturally then expected to be configurable by a variable or constant of type Language.)
Attachments¶
Many actions may also require attachments and other data such as PDF order confirmations, product manuals, etc. that may or may not be generated during dispatch.
To solve this, the script context also includes a list of Attachment objects (details TBD).
Actions such as “Render Order Confirmation PDF” would add Attachment objects to the context, while sending actions would consume them (optionally without removing them) from the context.
Notification Dispatch¶
Depending on the deployment and implementation, notification dispatch may occur asynchronously (in a non-blocking manner).
The author currently foresees no use case where asynchronous dispatch would cause issues, and as such, the specification contains no mechanism for declaring an event or script to be forcibly synchronous.
Persistent Notifications¶
In addition to the script core, the Notify app provides a Django model for notifications stored in the shop’s database. These are currently used only in the admin backend, but could be used in the frontend as well.
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
.
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.
Shoop API Documentation¶
Shoop Application API¶
See shoop.apps
.
Shoop Packages and Modules¶
shoop package¶
Subpackages¶
-
class
shoop.addons.admin_module.views.list.
AddonEnableDisableForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.addons.admin_module.views.list.
AddonListView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/addons/list.jinja'¶
-
form_class
¶ alias of
AddonEnableDisableForm
-
-
class
shoop.addons.admin_module.views.reload.
ReloadMethodForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.addons.admin_module.views.reload.
ReloadView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/addons/reload.jinja'¶
-
form_class
¶ alias of
ReloadMethodForm
-
-
class
shoop.addons.admin_module.views.upload.
AddonUploadForm
(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([('file', <django.forms.fields.FileField object at 0x7ff3d2dcdeb8>)])¶
-
declared_fields
= OrderedDict([('file', <django.forms.fields.FileField object at 0x7ff3d2dcdeb8>)])¶
-
media
¶
-
-
class
shoop.addons.admin_module.views.upload.
AddonUploadView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
AddonUploadForm
-
template_name
= 'shoop/admin/addons/upload.jinja'¶
-
title
= 'Upload Addon'¶
-
-
class
shoop.addons.admin_module.views.upload.
AddonUploadConfirmView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
Form
-
template_name
= 'shoop/admin/addons/upload_confirm.jinja'¶
-
title
= 'Upload Addon'¶
-
-
class
shoop.addons.admin_module.views.
AddonListView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
AddonEnableDisableForm
-
template_name
= 'shoop/admin/addons/list.jinja'¶
-
-
class
shoop.addons.admin_module.views.
AddonUploadView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
AddonUploadForm
-
template_name
= 'shoop/admin/addons/upload.jinja'¶
-
title
= 'Upload Addon'¶
-
-
class
shoop.addons.admin_module.views.
AddonUploadConfirmView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
Form
-
template_name
= 'shoop/admin/addons/upload_confirm.jinja'¶
-
title
= 'Upload Addon'¶
-
-
class
shoop.addons.admin_module.views.
ReloadView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
ReloadMethodForm
-
template_name
= 'shoop/admin/addons/reload.jinja'¶
-
-
class
shoop.addons.reloader.
UwsgiReloadMethod
[source]¶ Bases:
shoop.addons.reloader.ReloadMethod
-
identifier
= 'uwsgi'¶
-
title
= 'Reload uWSGI (uwsgi.reload())'¶
-
-
class
shoop.addons.reloader.
DevServerReloadMethod
[source]¶ Bases:
shoop.addons.reloader.ReloadMethod
-
identifier
= 'devserver'¶
-
title
= 'Reload Django Dev Server'¶
-
-
class
shoop.addons.reloader.
ModWSGIReloadMethod
[source]¶ Bases:
shoop.addons.reloader.ReloadMethod
-
identifier
= 'mod_wsgi'¶
-
title
= 'Reload Daemon Mode mod_wsgi'¶
-
-
class
shoop.addons.reloader.
GunicornReloadMethod
[source]¶ Bases:
shoop.addons.reloader.ReloadMethod
-
identifier
= 'gunicorn'¶
-
title
= 'Reload Gunicorn Master'¶
-
-
class
shoop.admin.dashboard.blocks.
DashboardBlock
(id, size=None, color=None)[source]¶ Bases:
object
-
type
= None¶
-
SIZES
= ('small', 'medium', 'large', 'full')¶
-
default_size
= 'normal'¶
-
-
class
shoop.admin.dashboard.blocks.
DashboardContentBlock
(id, content, size='normal')[source]¶ Bases:
shoop.admin.dashboard.blocks.DashboardBlock
-
type
= 'normal'¶
-
-
class
shoop.admin.dashboard.blocks.
DashboardValueBlock
(id, value, title, **kwargs)[source]¶ Bases:
shoop.admin.dashboard.blocks.DashboardBlock
-
type
= 'value'¶
-
default_size
= 'small'¶
-
-
class
shoop.admin.dashboard.blocks.
DashboardMoneyBlock
(id, value, title, currency, **kwargs)[source]¶
-
class
shoop.admin.dashboard.blocks.
DashboardChartBlock
(id, size='normal')[source]¶ Bases:
shoop.admin.dashboard.blocks.DashboardBlock
-
type
= 'chart'¶
-
default_size
= 'medium'¶
-
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 '¶
-
-
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.forms.widgets.
BasePopupChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
django.forms.widgets.Widget
-
browse_kind
= None¶
-
filter
= None¶
-
media
¶
-
-
class
shoop.admin.forms.widgets.
MediaChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
shoop.admin.forms.widgets.BasePopupChoiceWidget
-
browse_kind
= 'media'¶
-
media
¶
-
-
class
shoop.admin.forms.widgets.
ImageChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
shoop.admin.forms.widgets.MediaChoiceWidget
-
filter
= 'images'¶
-
media
¶
-
-
class
shoop.admin.forms.widgets.
ProductChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
shoop.admin.forms.widgets.BasePopupChoiceWidget
-
browse_kind
= 'product'¶
-
media
¶
-
-
class
shoop.admin.forms.widgets.
ContactChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
shoop.admin.forms.widgets.BasePopupChoiceWidget
-
browse_kind
= 'contact'¶
-
media
¶
-
-
class
shoop.admin.forms.widgets.
PersonContactChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
shoop.admin.forms.widgets.ContactChoiceWidget
-
filter
¶
-
media
¶
-
-
class
shoop.admin.forms.widgets.
PackageProductChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
shoop.admin.forms.widgets.ProductChoiceWidget
-
filter
= '{"modes": [0, 4]}'¶
-
media
¶
-
-
class
shoop.admin.modules.attributes.views.edit.
AttributeForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
AttributeForm.
base_fields
= OrderedDict([('identifier', <django.forms.fields.CharField object at 0x7ff3d26372b0>), ('searchable', <django.forms.fields.BooleanField object at 0x7ff3d25fb278>), ('type', <enumfields.forms.EnumChoiceField object at 0x7ff3d2f50d30>), ('visibility_mode', <enumfields.forms.EnumChoiceField object at 0x7ff3d25fb630>), ('name', <django.forms.fields.CharField object at 0x7ff3d49c4748>)])¶
-
AttributeForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d49c4748>)])¶
-
AttributeForm.
media
¶
-
-
class
shoop.admin.modules.attributes.views.edit.
AttributeEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Attribute
-
form_class
¶ alias of
AttributeForm
-
template_name
= 'shoop/admin/attributes/edit.jinja'¶
-
context_object_name
= 'attribute'¶
-
-
class
shoop.admin.modules.attributes.views.list.
AttributeListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Attribute
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d25fb3c8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25fb2b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25fb358>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25fb160>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2864c88>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f346d8>]¶
-
-
class
shoop.admin.modules.attributes.views.
AttributeEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'attribute'¶
-
form_class
¶ alias of
AttributeForm
-
model
¶ alias of
Attribute
-
template_name
= 'shoop/admin/attributes/edit.jinja'¶
-
-
class
shoop.admin.modules.attributes.views.
AttributeListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d25fb3c8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25fb2b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25fb358>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25fb160>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2864c88>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f346d8>]¶
-
model
¶ alias of
Attribute
-
-
class
shoop.admin.modules.categories.views.edit.
CategoryBaseForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
Category
-
fields
= ('parent', 'shops', 'status', 'ordering', 'visibility', 'visibility_groups', 'name', 'image', 'description', 'slug')¶
-
widgets
= {'visibility': <class 'django.forms.widgets.RadioSelect'>, 'status': <class 'django.forms.widgets.RadioSelect'>}¶
-
-
CategoryBaseForm.
base_fields
= OrderedDict([('parent', <mptt.forms.TreeNodeChoiceField object at 0x7ff3d2875438>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d2875ac8>), ('status', <enumfields.forms.EnumChoiceField object at 0x7ff3d279b978>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d27873c8>), ('visibility', <enumfields.forms.EnumChoiceField object at 0x7ff3d27d84a8>), ('visibility_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d27d8f28>), ('name', <django.forms.fields.CharField object at 0x7ff3d27d82b0>), ('image', <filer.fields.image.AdminImageFormField object at 0x7ff3d279bac8>), ('description', <django.forms.fields.CharField object at 0x7ff3d27d8390>), ('slug', <django.forms.fields.SlugField object at 0x7ff3d27d86d8>)])¶
-
CategoryBaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d27d82b0>), ('description', <django.forms.fields.CharField object at 0x7ff3d27d8390>), ('slug', <django.forms.fields.SlugField object at 0x7ff3d27d86d8>)])¶
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Category
-
template_name
= 'shoop/admin/categories/edit.jinja'¶
-
context_object_name
= 'category'¶
-
base_form_part_classes
= [<class 'shoop.admin.modules.categories.views.edit.CategoryBaseFormPart'>]¶
-
form_part_class_provide_key
= 'admin_category_form_part'¶
-
-
class
shoop.admin.modules.categories.views.list.
CategoryListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Category
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d27d89b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d27d8f60>, <shoop.admin.utils.picotable.Column object at 0x7ff3d27ab320>, <shoop.admin.utils.picotable.Column object at 0x7ff3d27abac8>]¶
-
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d27d89b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d27d8f60>, <shoop.admin.utils.picotable.Column object at 0x7ff3d27ab320>, <shoop.admin.utils.picotable.Column object at 0x7ff3d27abac8>]¶
-
model
¶ alias of
Category
-
-
class
shoop.admin.modules.contact_groups.views.delete.
ContactGroupDeleteView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.DeleteView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ContactGroup
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.contact_groups.views.edit.
ContactGroupEditView
(**kwargs)[source]¶ Bases:
shoop.admin.form_part.SaveFormPartsMixin
,shoop.admin.form_part.FormPartsViewMixin
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ContactGroup
-
template_name
= 'shoop/admin/contact_groups/edit.jinja'¶
-
context_object_name
= 'contact_group'¶
-
base_form_part_classes
= [<class 'shoop.admin.modules.contact_groups.views.forms.ContactGroupBaseFormPart'>, <class 'shoop.admin.modules.contact_groups.views.forms.ContactGroupMembersFormPart'>]¶
-
form_part_class_provide_key
= 'admin_contact_group_form_part'¶
-
-
class
shoop.admin.modules.contact_groups.views.forms.
ContactGroupBaseForm
(*args, **kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
ContactGroupBaseForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d303a668>)])¶
-
ContactGroupBaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d303a668>)])¶
-
ContactGroupBaseForm.
media
¶
-
-
class
shoop.admin.modules.contact_groups.views.forms.
ContactGroupBaseFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= 0¶
-
-
class
shoop.admin.modules.contact_groups.views.forms.
ContactGroupMembersForm
(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([('member', <django.forms.models.ModelChoiceField object at 0x7ff3d303a0b8>)])¶
-
declared_fields
= OrderedDict([('member', <django.forms.models.ModelChoiceField object at 0x7ff3d303a0b8>)])¶
-
media
¶
-
-
class
shoop.admin.modules.contact_groups.views.list.
ContactGroupListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.picotable.PicotableViewMixin
,django.views.generic.list.ListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ContactGroup
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d303abe0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d303a320>]¶
-
-
class
shoop.admin.modules.contact_groups.views.
ContactGroupDeleteView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.DeleteView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ContactGroup
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.contact_groups.views.
ContactGroupEditView
(**kwargs)[source]¶ Bases:
shoop.admin.form_part.SaveFormPartsMixin
,shoop.admin.form_part.FormPartsViewMixin
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
base_form_part_classes
= [<class 'shoop.admin.modules.contact_groups.views.forms.ContactGroupBaseFormPart'>, <class 'shoop.admin.modules.contact_groups.views.forms.ContactGroupMembersFormPart'>]¶
-
context_object_name
= 'contact_group'¶
-
form_part_class_provide_key
= 'admin_contact_group_form_part'¶
-
model
¶ alias of
ContactGroup
-
template_name
= 'shoop/admin/contact_groups/edit.jinja'¶
-
-
class
shoop.admin.modules.contact_groups.views.
ContactGroupListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.picotable.PicotableViewMixin
,django.views.generic.list.ListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d303abe0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d303a320>]¶
-
model
¶ alias of
ContactGroup
-
-
class
shoop.admin.modules.contacts.views.detail.
ContactDetailToolbar
(contact, request)[source]¶ Bases:
shoop.admin.toolbar.Toolbar
-
class
shoop.admin.modules.contacts.views.detail.
ContactDetailView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Contact
-
template_name
= 'shoop/admin/contacts/detail.jinja'¶
-
context_object_name
= 'contact'¶
-
-
class
shoop.admin.modules.contacts.views.edit.
ContactBaseForm
(bind_user=None, *args, **kwargs)[source]¶ Bases:
django.forms.models.BaseModelForm
This form is notoriously confusing in that it works in several different modes depending on what the instance being passed in is.
If the instance is an unsaved object, the form will show fields for the common superclass Contact as well as a type selection field. When saving the object, a _new_ instance is created, as its class will have been specialized into the actual concrete polymorphic type. (I said this is confusing.)
If the instance is a saved object, its type is checked and only the related fields are shown and none of that specialization stuff occurs.
-
FIELDS_BY_MODEL_NAME
= {'PersonContact': ('gender', 'birth_date', 'first_name', 'last_name'), 'Contact': ('is_active', 'language', 'marketing_permission', 'phone', 'www', 'timezone', 'prefix', 'suffix', 'name_ext', 'email', 'tax_group', 'merchant_notes', 'account_manager'), 'CompanyContact': ('name', 'tax_number', 'members')}¶
-
-
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.
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
-
model
¶ alias of
MutableAddress
-
fields
= ('prefix', 'name', 'suffix', 'name_ext', 'phone', 'email', 'street', 'street2', 'street3', 'postal_code', 'city', 'region_code', 'region', 'country')¶
-
-
AddressForm.
base_fields
= OrderedDict([('prefix', <django.forms.fields.CharField object at 0x7ff3d7c29e48>), ('name', <django.forms.fields.CharField object at 0x7ff3d29674e0>), ('suffix', <django.forms.fields.CharField object at 0x7ff3d2ef27f0>), ('name_ext', <django.forms.fields.CharField object at 0x7ff3d2b03e48>), ('phone', <django.forms.fields.CharField object at 0x7ff3d2b03128>), ('email', <django.forms.fields.EmailField object at 0x7ff3d2b34be0>), ('street', <django.forms.fields.CharField object at 0x7ff3d2b34518>), ('street2', <django.forms.fields.CharField object at 0x7ff3d2b34048>), ('street3', <django.forms.fields.CharField object at 0x7ff3d2b340f0>), ('postal_code', <django.forms.fields.CharField object at 0x7ff3d2b34f98>), ('city', <django.forms.fields.CharField object at 0x7ff3d2b34080>), ('region_code', <django.forms.fields.CharField object at 0x7ff3d2b34908>), ('region', <django.forms.fields.CharField object at 0x7ff3d2e82198>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7ff3d2b34a20>)])¶
-
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.
ContactEditView
(**kwargs)[source]¶ Bases:
shoop.admin.form_part.SaveFormPartsMixin
,shoop.admin.form_part.FormPartsViewMixin
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Contact
-
template_name
= 'shoop/admin/contacts/edit.jinja'¶
-
context_object_name
= 'contact'¶
-
base_form_part_classes
= [<class 'shoop.admin.modules.contacts.views.edit.ContactBaseFormPart'>, <class 'shoop.admin.modules.contacts.views.edit.ContactAddressesFormPart'>]¶
-
form_part_class_provide_key
= 'admin_contact_form_part'¶
-
-
class
shoop.admin.modules.contacts.views.list.
ContactListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Contact
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2b34748>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34630>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34588>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34550>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34668>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b346d8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b343c8>]¶
-
-
class
shoop.admin.modules.contacts.views.reset.
ContactResetPasswordView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.users.views.password.UserResetPasswordView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
shoop.admin.modules.contacts.views.
ContactListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2b34748>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34630>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34588>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34550>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b34668>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b346d8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2b343c8>]¶
-
model
¶ alias of
Contact
-
-
class
shoop.admin.modules.contacts.views.
ContactDetailView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
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
-
-
class
shoop.admin.modules.manufacturers.views.edit.
ManufacturerForm
(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
-
model
¶ alias of
Manufacturer
-
exclude
= ('identifier', 'created_on')¶
-
-
ManufacturerForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d2a907f0>), ('url', <django.forms.fields.CharField object at 0x7ff3d2ee1eb8>)])¶
-
ManufacturerForm.
declared_fields
= OrderedDict()¶
-
ManufacturerForm.
media
¶
-
class
-
class
shoop.admin.modules.manufacturers.views.edit.
ManufacturerEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Manufacturer
-
form_class
¶ alias of
ManufacturerForm
-
template_name
= 'shoop/admin/manufacturers/edit.jinja'¶
-
context_object_name
= 'manufacturer'¶
-
-
class
shoop.admin.modules.manufacturers.views.list.
ManufacturerListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Manufacturer
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2a90940>]¶
-
-
class
shoop.admin.modules.manufacturers.views.
ManufacturerEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'manufacturer'¶
-
form_class
¶ alias of
ManufacturerForm
-
model
¶ alias of
Manufacturer
-
template_name
= 'shoop/admin/manufacturers/edit.jinja'¶
-
-
class
shoop.admin.modules.manufacturers.views.
ManufacturerListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2a90940>]¶
-
model
¶ alias of
Manufacturer
-
-
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.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/media/browser.jinja'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.orders.views.detail.
OrderDetailView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/detail.jinja'¶
-
context_object_name
= 'order'¶
-
-
class
shoop.admin.modules.orders.views.detail.
OrderSetStatusView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
-
shoop.admin.modules.orders.views.edit.
update_order_from_state
(state, order_to_update, **kwargs)[source]¶
-
shoop.admin.modules.orders.views.edit.
get_price_info
(shop, customer, product, quantity)[source]¶ Get price info of given product for given context parameters.
-
class
shoop.admin.modules.orders.views.edit.
OrderEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create.jinja'¶
-
context_object_name
= 'order'¶
-
title
= 'Create Order'¶
-
fields
= []¶
-
-
class
shoop.admin.modules.orders.views.list.
OrderListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d25e7710>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25e7a20>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25e72e8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d28c5a90>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f108d0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f10470>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f10668>]¶
-
-
class
shoop.admin.modules.orders.views.log.
NewLogEntryView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
Create a log
note
item associated with a particular order.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
shoop.admin.modules.orders.views.payment.
OrderCreatePaymentView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_payment.jinja'¶
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
Form
-
get_form
(form_class=None)¶
-
-
class
shoop.admin.modules.orders.views.refund.
RefundForm
(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([('line_number', <django.forms.fields.ChoiceField object at 0x7ff3d2f10860>), ('quantity', <django.forms.fields.DecimalField object at 0x7ff3d2f100b8>), ('amount', <django.forms.fields.DecimalField object at 0x7ff3d2f10c50>), ('restock_products', <django.forms.fields.BooleanField object at 0x7ff3d2f10be0>)])¶
-
declared_fields
= OrderedDict([('line_number', <django.forms.fields.ChoiceField object at 0x7ff3d2f10860>), ('quantity', <django.forms.fields.DecimalField object at 0x7ff3d2f100b8>), ('amount', <django.forms.fields.DecimalField object at 0x7ff3d2f10c50>), ('restock_products', <django.forms.fields.BooleanField object at 0x7ff3d2f10be0>)])¶
-
media
¶
-
-
class
shoop.admin.modules.orders.views.refund.
OrderCreateRefundView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_refund.jinja'¶
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
RefundFormFormSet
-
get_form
(form_class=None)¶
-
-
class
shoop.admin.modules.orders.views.refund.
FullRefundConfirmationForm
(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([('restock_products', <django.forms.fields.BooleanField object at 0x7ff3d2f106d8>)])¶
-
declared_fields
= OrderedDict([('restock_products', <django.forms.fields.BooleanField object at 0x7ff3d2f106d8>)])¶
-
media
¶
-
-
class
shoop.admin.modules.orders.views.refund.
OrderCreateFullRefundView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_full_refund.jinja'¶
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
FullRefundConfirmationForm
-
-
class
shoop.admin.modules.orders.views.shipment.
ShipmentFormModifier
[source]¶ Bases:
object
-
get_extra_fields
(order)[source]¶ Extra fields for shipment creation view.
Parameters: order (shoop.core.models.Order) – Order linked to form Returns: List of extra fields that should be added to form. Tuple should contain field name and Django form field. :rtype: list[(str,django.forms.Field)]
-
clean_hook
(form)[source]¶ Extra clean for shipment creation form.
This hook will be called in
clean
method of the form, after calling parent clean. Implementor of this hook may calladd_error
to add errors to form or modify theform.cleaned_data
dictionary.Parameters: form (ShipmentForm) – Form that is currently cleaned Return type: None
-
form_valid_hook
(form, shipment)[source]¶ Extra form valid handler for shipment creation view.
This is called from
OrderCreateShipmentView
just before theOrder.create_shipment
Parameters: - form (ShipmentForm) – Form that is currently handled
- shipment (shoop.core.models.Shipment) – Unsaved shipment
Return type:
-
-
class
shoop.admin.modules.orders.views.shipment.
ShipmentForm
(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()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.admin.modules.orders.views.shipment.
OrderCreateShipmentView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_shipment.jinja'¶
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
ShipmentForm
-
get_form
(form_class=None)¶
-
-
class
shoop.admin.modules.orders.views.
NewLogEntryView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
Create a log
note
item associated with a particular order.Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
shoop.admin.modules.orders.views.
OrderDetailView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'order'¶
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/detail.jinja'¶
-
-
class
shoop.admin.modules.orders.views.
OrderEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'order'¶
-
fields
= []¶
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create.jinja'¶
-
title
= 'Create Order'¶
-
-
class
shoop.admin.modules.orders.views.
OrderListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d25e7710>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25e7a20>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25e72e8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d28c5a90>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f108d0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f10470>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2f10668>]¶
-
model
¶ alias of
Order
-
-
class
shoop.admin.modules.orders.views.
OrderCreatePaymentView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
Form
-
get_form
(form_class=None)¶
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_payment.jinja'¶
-
-
class
shoop.admin.modules.orders.views.
OrderCreateFullRefundView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
FullRefundConfirmationForm
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_full_refund.jinja'¶
-
-
class
shoop.admin.modules.orders.views.
OrderCreateRefundView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
RefundFormFormSet
-
get_form
(form_class=None)¶
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_refund.jinja'¶
-
-
class
shoop.admin.modules.orders.views.
OrderCreateShipmentView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'order'¶
-
form_class
¶ alias of
ShipmentForm
-
get_form
(form_class=None)¶
-
model
¶ alias of
Order
-
template_name
= 'shoop/admin/orders/create_shipment.jinja'¶
-
-
class
shoop.admin.modules.orders.views.
OrderSetStatusView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
-
class
shoop.admin.modules.orders.json_order_creator.
JsonOrderCreator
[source]¶ Bases:
object
-
is_valid
¶
-
errors
¶
-
create_source_from_state
(state, creator=None, ip_address=None, save=False, order_to_update=None)[source]¶ Create an order source from a state dict unserialized from JSON.
Parameters: - state (dict) – State dictionary
- creator (django.contrib.auth.models.User|None) – Creator user
- save (boolean) – Flag whether order customer and addresses is saved to database
- order_to_update (shoop.core.models.Order|None) – Order object to edit
Returns: The created order source, or None if something failed along the way
Return type: OrderSource|None
-
create_order_from_state
(state, creator=None, ip_address=None)[source]¶ Create an order from a state dict unserialized from JSON.
Parameters: Returns: The created order, or None if something failed along the way
Return type: Order|None
-
update_order_from_state
(state, order_to_update, modified_by=None)[source]¶ Update an order from a state dict unserialized from JSON.
Parameters: - state (dict) – State dictionary
- order_to_update (shoop.core.models.Order) – Order object to edit
Returns: The created order, or None if something failed along the way
Return type: Order|None
-
-
class
shoop.admin.modules.orders.sections.
PaymentOrderSection
[source]¶ Bases:
shoop.admin.base.OrderSection
-
identifier
= 'payments'¶
-
name
= 'Payments'¶
-
icon
= 'fa-dollar'¶
-
template
= 'shoop/admin/orders/_detail_payments.jinja'¶
-
order
= 1¶
-
-
class
shoop.admin.modules.orders.sections.
ContentsOrderSection
[source]¶ Bases:
shoop.admin.base.OrderSection
-
identifier
= 'contents'¶
-
name
= 'Order Contents'¶
-
icon
= 'fa-file-text'¶
-
template
= 'shoop/admin/orders/_order_contents.jinja'¶
-
order
= 2¶
-
-
class
shoop.admin.modules.orders.sections.
LogEntriesOrderSection
[source]¶ Bases:
shoop.admin.base.OrderSection
-
identifier
= 'log_entries'¶
-
name
= 'Log Entries'¶
-
icon
= 'fa-pencil'¶
-
template
= 'shoop/admin/orders/_order_log_entries.jinja'¶
-
extra_js
= 'shoop/admin/orders/_order_log_entries_extra_js.jinja'¶
-
order
= 3¶
-
-
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.permission_groups.views.edit.
PermissionGroupForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
PermissionGroupForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d2a30f98>)])¶
-
PermissionGroupForm.
declared_fields
= OrderedDict()¶
-
PermissionGroupForm.
media
¶
-
-
class
shoop.admin.modules.permission_groups.views.edit.
PermissionGroupEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Group
-
form_class
¶ alias of
PermissionGroupForm
-
template_name
= 'shoop/admin/permission_groups/edit.jinja'¶
-
context_object_name
= 'permission_group'¶
-
add_form_errors_as_messages
= True¶
-
-
class
shoop.admin.modules.permission_groups.views.list.
PermissionGroupListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Group
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d21e9080>]¶
-
-
class
shoop.admin.modules.permission_groups.views.
PermissionGroupEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
add_form_errors_as_messages
= True¶
-
context_object_name
= 'permission_group'¶
-
form_class
¶ alias of
PermissionGroupForm
-
model
¶ alias of
Group
-
template_name
= 'shoop/admin/permission_groups/edit.jinja'¶
-
-
class
shoop.admin.modules.permission_groups.views.
PermissionGroupListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d21e9080>]¶
-
model
¶ alias of
Group
-
-
class
shoop.admin.modules.product_types.views.edit.
ProductTypeForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
ProductType
-
exclude
= ()¶
-
widgets
= {'attributes': <class 'django.forms.widgets.CheckboxSelectMultiple'>}¶
-
-
ProductTypeForm.
base_fields
= OrderedDict([('attributes', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d238bf60>), ('name', <django.forms.fields.CharField object at 0x7ff3d1d15dd8>)])¶
-
ProductTypeForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d1d15dd8>)])¶
-
ProductTypeForm.
media
¶
-
class
-
class
shoop.admin.modules.product_types.views.edit.
ProductTypeEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ProductType
-
form_class
¶ alias of
ProductTypeForm
-
template_name
= 'shoop/admin/product_types/edit.jinja'¶
-
context_object_name
= 'product_type'¶
-
-
class
shoop.admin.modules.product_types.views.list.
ProductTypeListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ProductType
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d1d15978>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1f672b0>]¶
-
-
class
shoop.admin.modules.product_types.views.
ProductTypeEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'product_type'¶
-
form_class
¶ alias of
ProductTypeForm
-
model
¶ alias of
ProductType
-
template_name
= 'shoop/admin/product_types/edit.jinja'¶
-
-
class
shoop.admin.modules.product_types.views.
ProductTypeListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d1d15978>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1f672b0>]¶
-
model
¶ alias of
ProductType
-
-
class
shoop.admin.modules.products.forms.base_forms.
ProductBaseForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
Product
-
fields
= ('accounting_identifier', 'barcode', 'category', 'cost_center', 'depth', 'gross_weight', 'gtin', 'height', 'manufacturer', 'net_weight', 'profit_center', 'sales_unit', 'shipping_mode', 'sku', 'stock_behavior', 'tax_class', 'type', 'width', 'description', 'keywords', 'name', 'status_text', 'variation_name')¶
-
widgets
= {'keywords': <django.forms.widgets.TextInput object at 0x7ff3d2134be0>}¶
-
-
ProductBaseForm.
base_fields
= OrderedDict([('accounting_identifier', <django.forms.fields.CharField object at 0x7ff3d1cc76d8>), ('barcode', <django.forms.fields.CharField object at 0x7ff3d2c45c18>), ('category', <django.forms.models.ModelChoiceField object at 0x7ff3d1c2ac18>), ('cost_center', <django.forms.fields.CharField object at 0x7ff3d1c2ab00>), ('depth', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1d28fd0>), ('gross_weight', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c2af60>), ('gtin', <django.forms.fields.CharField object at 0x7ff3d1c2a710>), ('height', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c2ae10>), ('manufacturer', <django.forms.models.ModelChoiceField object at 0x7ff3d1c18240>), ('net_weight', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d27e87f0>), ('profit_center', <django.forms.fields.CharField object at 0x7ff3d1c2a9e8>), ('sales_unit', <django.forms.models.ModelChoiceField object at 0x7ff3d1c12240>), ('shipping_mode', <enumfields.forms.EnumChoiceField object at 0x7ff3d2c56780>), ('sku', <django.forms.fields.CharField object at 0x7ff3d2134b00>), ('stock_behavior', <enumfields.forms.EnumChoiceField object at 0x7ff3d1cd0ba8>), ('tax_class', <django.forms.models.ModelChoiceField object at 0x7ff3d1cc7fd0>), ('type', <django.forms.models.ModelChoiceField object at 0x7ff3d1c2a470>), ('width', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c2ada0>), ('description', <django.forms.fields.CharField object at 0x7ff3d2594f28>), ('keywords', <django.forms.fields.CharField object at 0x7ff3d1c07b00>), ('name', <django.forms.fields.CharField object at 0x7ff3d1c78f28>), ('status_text', <django.forms.fields.CharField object at 0x7ff3d1c07cc0>), ('variation_name', <django.forms.fields.CharField object at 0x7ff3d1c07f28>)])¶
-
ProductBaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d1c78f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d2594f28>), ('keywords', <django.forms.fields.CharField object at 0x7ff3d1c07b00>), ('status_text', <django.forms.fields.CharField object at 0x7ff3d1c07cc0>), ('variation_name', <django.forms.fields.CharField object at 0x7ff3d1c07f28>)])¶
-
ProductBaseForm.
media
¶
-
class
-
class
shoop.admin.modules.products.forms.base_forms.
ShopProductForm
(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
ShopProduct
-
fields
= ('default_price_value', 'minimum_price_value', 'suppliers', 'visible', 'listed', 'purchasable', 'searchable', 'visibility_limit', 'visibility_groups', 'purchase_multiple', 'minimum_purchase_quantity', 'limit_shipping_methods', 'limit_payment_methods', 'shipping_methods', 'payment_methods', 'primary_category', 'categories')¶
-
-
ShopProductForm.
base_fields
= OrderedDict([('default_price_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c38e80>), ('minimum_price_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c38f28>), ('suppliers', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d21e63c8>), ('visible', <django.forms.fields.BooleanField object at 0x7ff3d1c187b8>), ('listed', <django.forms.fields.BooleanField object at 0x7ff3d1c38048>), ('purchasable', <django.forms.fields.BooleanField object at 0x7ff3d21cd550>), ('searchable', <django.forms.fields.BooleanField object at 0x7ff3d1c381d0>), ('visibility_limit', <enumfields.forms.EnumChoiceField object at 0x7ff3d1c38278>), ('visibility_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38320>), ('purchase_multiple', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c384e0>), ('minimum_purchase_quantity', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c38588>), ('limit_shipping_methods', <django.forms.fields.BooleanField object at 0x7ff3d1c38630>), ('limit_payment_methods', <django.forms.fields.BooleanField object at 0x7ff3d1c386d8>), ('shipping_methods', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38780>), ('payment_methods', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38940>), ('primary_category', <django.forms.models.ModelChoiceField object at 0x7ff3d1c38b00>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38cc0>)])¶
-
ShopProductForm.
declared_fields
= OrderedDict()¶
-
ShopProductForm.
media
¶
-
class
-
class
shoop.admin.modules.products.forms.base_forms.
ProductAttributesForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.base_forms.
BaseProductMediaForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
ProductMedia
-
fields
= ('file', 'ordering', 'external_url', 'public', 'title', 'description', 'purchased', 'shops', 'kind')¶
-
-
BaseProductMediaForm.
get_thumbnail
(request)[source]¶ Get thumbnail url.
If thumbnail creation fails for whatever reason, an error message is displayed for user.
-
BaseProductMediaForm.
base_fields
= OrderedDict([('file', <filer.fields.file.AdminFileFormField object at 0x7ff3d1c40390>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d1c406a0>), ('external_url', <django.forms.fields.URLField object at 0x7ff3d1c40588>), ('public', <django.forms.fields.BooleanField object at 0x7ff3d1c40748>), ('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('purchased', <django.forms.fields.BooleanField object at 0x7ff3d1c407f0>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1f6b358>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7ff3d1c402e8>)])¶
-
BaseProductMediaForm.
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>)])¶
-
BaseProductMediaForm.
media
¶
-
class
-
class
shoop.admin.modules.products.forms.base_forms.
BaseProductMediaFormSet
(*args, **kwargs)[source]¶ Bases:
django.forms.models.BaseModelFormSet
-
validate_min
= False¶
-
min_num
= 0¶
-
validate_max
= False¶
-
max_num
= 1000¶
-
absolute_max
= 1000¶
-
model
¶ alias of
ProductMedia
-
can_delete
= True¶
-
can_order
= False¶
-
extra
= 1¶
-
allowed_media_kinds
= []¶
-
-
class
shoop.admin.modules.products.forms.base_forms.
ProductMediaForm
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.BaseProductMediaForm
-
base_fields
= OrderedDict([('file', <filer.fields.file.AdminFileFormField object at 0x7ff3d1c40b38>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d1c40e10>), ('external_url', <django.forms.fields.URLField object at 0x7ff3d1c40cf8>), ('public', <django.forms.fields.BooleanField object at 0x7ff3d1c40eb8>), ('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('purchased', <django.forms.fields.BooleanField object at 0x7ff3d1c40f60>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c408d0>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7ff3d1c40a90>)])¶
-
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.base_forms.
ProductMediaFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.BaseProductMediaFormSet
-
form_class
¶ alias of
ProductMediaForm
-
allowed_media_kinds
= [<ProductMediaKind.GENERIC_FILE: 1>, <ProductMediaKind.DOCUMENTATION: 3>, <ProductMediaKind.SAMPLE: 4>]¶
-
-
class
shoop.admin.modules.products.forms.base_forms.
ProductImageMediaForm
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.BaseProductMediaForm
-
base_fields
= OrderedDict([('file', <filer.fields.file.AdminFileFormField object at 0x7ff3d1bc7390>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d1bc7668>), ('external_url', <django.forms.fields.URLField object at 0x7ff3d1bc7550>), ('public', <django.forms.fields.BooleanField object at 0x7ff3d1bc7710>), ('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('purchased', <django.forms.fields.BooleanField object at 0x7ff3d1bc77b8>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1bc7128>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7ff3d1bc72e8>), ('is_primary', <django.forms.fields.BooleanField object at 0x7ff3d1c40fd0>)])¶
-
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('is_primary', <django.forms.fields.BooleanField object at 0x7ff3d1c40fd0>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.base_forms.
ProductImageMediaFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.ProductMediaFormSet
-
allowed_media_kinds
= [<ProductMediaKind.IMAGE: 2>]¶
-
form_class
¶ alias of
ProductImageMediaForm
-
-
class
shoop.admin.modules.products.forms.package_forms.
PackageChildForm
(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([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d1bc7a58>), ('quantity', <django.forms.fields.DecimalField object at 0x7ff3d1bc7b70>)])¶
-
declared_fields
= OrderedDict([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d1bc7a58>), ('quantity', <django.forms.fields.DecimalField object at 0x7ff3d1bc7b70>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.parent_forms.
ProductChildBaseFormSet
(**kwargs)[source]¶ Bases:
django.forms.formsets.BaseFormSet
-
deletion_label
= None¶
-
-
class
shoop.admin.modules.products.forms.simple_variation_forms.
SimpleVariationChildForm
(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([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d2134d30>)])¶
-
declared_fields
= OrderedDict([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d2134d30>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.simple_variation_forms.
SimpleVariationChildFormSet
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.parent_forms.ProductChildBaseFormSet
-
deletion_label
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.products.forms.variable_variation_forms.
VariableVariationChildrenForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.variable_variation_forms.
VariationVariablesDataForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('data', <django.forms.fields.CharField object at 0x7ff3d1bcc128>)])¶
-
declared_fields
= OrderedDict([('data', <django.forms.fields.CharField object at 0x7ff3d1bcc128>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.
BaseProductMediaForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
fields
= ('file', 'ordering', 'external_url', 'public', 'title', 'description', 'purchased', 'shops', 'kind')¶
-
model
¶ alias of
ProductMedia
-
-
BaseProductMediaForm.
base_fields
= OrderedDict([('file', <filer.fields.file.AdminFileFormField object at 0x7ff3d1c40390>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d1c406a0>), ('external_url', <django.forms.fields.URLField object at 0x7ff3d1c40588>), ('public', <django.forms.fields.BooleanField object at 0x7ff3d1c40748>), ('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('purchased', <django.forms.fields.BooleanField object at 0x7ff3d1c407f0>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1f6b358>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7ff3d1c402e8>)])¶
-
BaseProductMediaForm.
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>)])¶
-
BaseProductMediaForm.
get_thumbnail
(request)[source]¶ Get thumbnail url.
If thumbnail creation fails for whatever reason, an error message is displayed for user.
-
BaseProductMediaForm.
media
¶
-
class
-
class
shoop.admin.modules.products.forms.
PackageChildForm
(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([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d1bc7a58>), ('quantity', <django.forms.fields.DecimalField object at 0x7ff3d1bc7b70>)])¶
-
declared_fields
= OrderedDict([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d1bc7a58>), ('quantity', <django.forms.fields.DecimalField object at 0x7ff3d1bc7b70>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.
PackageChildFormSet
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.parent_forms.ProductChildBaseFormSet
-
deletion_label
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.products.forms.
ProductAttributesForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.
ProductBaseForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
fields
= ('accounting_identifier', 'barcode', 'category', 'cost_center', 'depth', 'gross_weight', 'gtin', 'height', 'manufacturer', 'net_weight', 'profit_center', 'sales_unit', 'shipping_mode', 'sku', 'stock_behavior', 'tax_class', 'type', 'width', 'description', 'keywords', 'name', 'status_text', 'variation_name')¶
-
model
¶ alias of
Product
-
widgets
= {'keywords': <django.forms.widgets.TextInput object at 0x7ff3d2134be0>}¶
-
-
ProductBaseForm.
base_fields
= OrderedDict([('accounting_identifier', <django.forms.fields.CharField object at 0x7ff3d1cc76d8>), ('barcode', <django.forms.fields.CharField object at 0x7ff3d2c45c18>), ('category', <django.forms.models.ModelChoiceField object at 0x7ff3d1c2ac18>), ('cost_center', <django.forms.fields.CharField object at 0x7ff3d1c2ab00>), ('depth', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1d28fd0>), ('gross_weight', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c2af60>), ('gtin', <django.forms.fields.CharField object at 0x7ff3d1c2a710>), ('height', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c2ae10>), ('manufacturer', <django.forms.models.ModelChoiceField object at 0x7ff3d1c18240>), ('net_weight', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d27e87f0>), ('profit_center', <django.forms.fields.CharField object at 0x7ff3d1c2a9e8>), ('sales_unit', <django.forms.models.ModelChoiceField object at 0x7ff3d1c12240>), ('shipping_mode', <enumfields.forms.EnumChoiceField object at 0x7ff3d2c56780>), ('sku', <django.forms.fields.CharField object at 0x7ff3d2134b00>), ('stock_behavior', <enumfields.forms.EnumChoiceField object at 0x7ff3d1cd0ba8>), ('tax_class', <django.forms.models.ModelChoiceField object at 0x7ff3d1cc7fd0>), ('type', <django.forms.models.ModelChoiceField object at 0x7ff3d1c2a470>), ('width', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c2ada0>), ('description', <django.forms.fields.CharField object at 0x7ff3d2594f28>), ('keywords', <django.forms.fields.CharField object at 0x7ff3d1c07b00>), ('name', <django.forms.fields.CharField object at 0x7ff3d1c78f28>), ('status_text', <django.forms.fields.CharField object at 0x7ff3d1c07cc0>), ('variation_name', <django.forms.fields.CharField object at 0x7ff3d1c07f28>)])¶
-
ProductBaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d1c78f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d2594f28>), ('keywords', <django.forms.fields.CharField object at 0x7ff3d1c07b00>), ('status_text', <django.forms.fields.CharField object at 0x7ff3d1c07cc0>), ('variation_name', <django.forms.fields.CharField object at 0x7ff3d1c07f28>)])¶
-
ProductBaseForm.
media
¶
-
class
-
class
shoop.admin.modules.products.forms.
ProductImageMediaForm
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.BaseProductMediaForm
-
base_fields
= OrderedDict([('file', <filer.fields.file.AdminFileFormField object at 0x7ff3d1bc7390>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d1bc7668>), ('external_url', <django.forms.fields.URLField object at 0x7ff3d1bc7550>), ('public', <django.forms.fields.BooleanField object at 0x7ff3d1bc7710>), ('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('purchased', <django.forms.fields.BooleanField object at 0x7ff3d1bc77b8>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1bc7128>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7ff3d1bc72e8>), ('is_primary', <django.forms.fields.BooleanField object at 0x7ff3d1c40fd0>)])¶
-
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('is_primary', <django.forms.fields.BooleanField object at 0x7ff3d1c40fd0>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.
ProductImageMediaFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.ProductMediaFormSet
-
allowed_media_kinds
= [<ProductMediaKind.IMAGE: 2>]¶
-
form_class
¶ alias of
ProductImageMediaForm
-
-
class
shoop.admin.modules.products.forms.
ProductMediaForm
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.BaseProductMediaForm
-
base_fields
= OrderedDict([('file', <filer.fields.file.AdminFileFormField object at 0x7ff3d1c40b38>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d1c40e10>), ('external_url', <django.forms.fields.URLField object at 0x7ff3d1c40cf8>), ('public', <django.forms.fields.BooleanField object at 0x7ff3d1c40eb8>), ('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>), ('purchased', <django.forms.fields.BooleanField object at 0x7ff3d1c40f60>), ('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c408d0>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7ff3d1c40a90>)])¶
-
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3d1d52f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1c400b8>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.
ProductMediaFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.base_forms.BaseProductMediaFormSet
-
allowed_media_kinds
= [<ProductMediaKind.GENERIC_FILE: 1>, <ProductMediaKind.DOCUMENTATION: 3>, <ProductMediaKind.SAMPLE: 4>]¶
-
form_class
¶ alias of
ProductMediaForm
-
-
class
shoop.admin.modules.products.forms.
ShopProductForm
(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
fields
= ('default_price_value', 'minimum_price_value', 'suppliers', 'visible', 'listed', 'purchasable', 'searchable', 'visibility_limit', 'visibility_groups', 'purchase_multiple', 'minimum_purchase_quantity', 'limit_shipping_methods', 'limit_payment_methods', 'shipping_methods', 'payment_methods', 'primary_category', 'categories')¶
-
model
¶ alias of
ShopProduct
-
-
ShopProductForm.
base_fields
= OrderedDict([('default_price_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c38e80>), ('minimum_price_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c38f28>), ('suppliers', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d21e63c8>), ('visible', <django.forms.fields.BooleanField object at 0x7ff3d1c187b8>), ('listed', <django.forms.fields.BooleanField object at 0x7ff3d1c38048>), ('purchasable', <django.forms.fields.BooleanField object at 0x7ff3d21cd550>), ('searchable', <django.forms.fields.BooleanField object at 0x7ff3d1c381d0>), ('visibility_limit', <enumfields.forms.EnumChoiceField object at 0x7ff3d1c38278>), ('visibility_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38320>), ('purchase_multiple', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c384e0>), ('minimum_purchase_quantity', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1c38588>), ('limit_shipping_methods', <django.forms.fields.BooleanField object at 0x7ff3d1c38630>), ('limit_payment_methods', <django.forms.fields.BooleanField object at 0x7ff3d1c386d8>), ('shipping_methods', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38780>), ('payment_methods', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38940>), ('primary_category', <django.forms.models.ModelChoiceField object at 0x7ff3d1c38b00>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1c38cc0>)])¶
-
ShopProductForm.
declared_fields
= OrderedDict()¶
-
ShopProductForm.
media
¶
-
class
-
class
shoop.admin.modules.products.forms.
SimpleVariationChildForm
(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([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d2134d30>)])¶
-
declared_fields
= OrderedDict([('child', <django.forms.models.ModelChoiceField object at 0x7ff3d2134d30>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.
SimpleVariationChildFormSet
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.forms.parent_forms.ProductChildBaseFormSet
-
deletion_label
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.products.forms.
VariableVariationChildrenForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.admin.modules.products.forms.
VariationVariablesDataForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('data', <django.forms.fields.CharField object at 0x7ff3d1bcc128>)])¶
-
declared_fields
= OrderedDict([('data', <django.forms.fields.CharField object at 0x7ff3d1bcc128>)])¶
-
media
¶
-
-
class
shoop.admin.modules.products.views.delete.
ProductDeleteView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Product
-
context_object_name
= 'product'¶
-
-
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.
ShopProductFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= -900¶
-
-
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.
BaseProductMediaFormPart
(request, object=None)[source]¶
-
class
shoop.admin.modules.products.views.edit.
ProductMediaFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.modules.products.views.edit.BaseProductMediaFormPart
-
name
= 'media'¶
-
priority
= -700¶
-
formset
¶ alias of
ProductMediaFormSet
-
-
class
shoop.admin.modules.products.views.edit.
ProductImageMediaFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.modules.products.views.edit.BaseProductMediaFormPart
-
name
= 'images'¶
-
priority
= -600¶
-
formset
¶ alias of
ProductImageMediaFormSet
-
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/edit.jinja'¶
-
context_object_name
= 'product'¶
-
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'>]¶
-
form_part_class_provide_key
= 'admin_product_form_part'¶
-
-
class
shoop.admin.modules.products.views.edit_cross_sell.
ProductCrossSellForm
(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
ProductCrossSell
-
fields
= ('product2', 'weight', 'type')¶
-
-
ProductCrossSellForm.
base_fields
= OrderedDict([('product2', <django.forms.models.ModelChoiceField object at 0x7ff3d1d52cf8>), ('weight', <django.forms.fields.IntegerField object at 0x7ff3d1d80780>), ('type', <enumfields.forms.EnumChoiceField object at 0x7ff3d2913208>)])¶
-
ProductCrossSellForm.
declared_fields
= OrderedDict()¶
-
ProductCrossSellForm.
media
¶
-
class
-
class
shoop.admin.modules.products.views.edit_cross_sell.
ProductCrossSellFormSet
(*args, **kwargs)[source]¶ Bases:
django.forms.models.BaseModelFormSet
-
validate_min
= False¶
-
min_num
= 0¶
-
validate_max
= False¶
-
max_num
= 1000¶
-
absolute_max
= 1000¶
-
model
¶ alias of
ProductMedia
-
can_delete
= True¶
-
can_order
= False¶
-
extra
= 5¶
-
-
class
shoop.admin.modules.products.views.edit_cross_sell.
ProductCrossSellEditView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/edit_cross_sell.jinja'¶
-
context_object_name
= 'product'¶
-
form_class
¶ alias of
ProductCrossSellFormSet
-
-
class
shoop.admin.modules.products.views.edit_media.
ProductMediaForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
ProductMedia
-
fields
= ('shops', 'kind', 'file', 'external_url', 'ordering', 'enabled', 'public', 'purchased', 'title', 'description')¶
-
-
ProductMediaForm.
base_fields
= OrderedDict([('shops', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1f77240>), ('kind', <enumfields.forms.EnumChoiceField object at 0x7ff3d1f779e8>), ('file', <filer.fields.file.AdminFileFormField object at 0x7ff3d1ff7860>), ('external_url', <django.forms.fields.URLField object at 0x7ff3d1ff74e0>), ('ordering', <django.forms.fields.IntegerField object at 0x7ff3d208c358>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3d1e0d7f0>), ('public', <django.forms.fields.BooleanField object at 0x7ff3d208cfd0>), ('purchased', <django.forms.fields.BooleanField object at 0x7ff3d208c710>), ('title', <django.forms.fields.CharField object at 0x7ff3d283f710>), ('description', <django.forms.fields.CharField object at 0x7ff3d1fef470>)])¶
-
ProductMediaForm.
declared_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3d283f710>), ('description', <django.forms.fields.CharField object at 0x7ff3d1fef470>)])¶
-
ProductMediaForm.
media
¶
-
class
-
class
shoop.admin.modules.products.views.edit_media.
ProductMediaFormSet
(*args, **kwargs)[source]¶ Bases:
django.forms.models.BaseModelFormSet
-
validate_min
= False¶
-
min_num
= 0¶
-
validate_max
= False¶
-
max_num
= 1000¶
-
absolute_max
= 1000¶
-
model
¶ alias of
ProductMedia
-
can_delete
= True¶
-
can_order
= False¶
-
extra
= 5¶
-
-
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.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Product
-
template_name
= 'shoop/admin/products/edit_media.jinja'¶
-
context_object_name
= 'product'¶
-
form_class
¶ alias of
ProductMediaFormSet
-
-
class
shoop.admin.modules.products.views.edit_package.
ProductChildrenFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductChildrenBaseFormPart
-
invalid_modes
= [<ProductMode.VARIATION_CHILD: 4>, <ProductMode.VARIABLE_VARIATION_PARENT: 3>, <ProductMode.SIMPLE_VARIATION_PARENT: 2>]¶
-
priority
= 0¶
-
-
class
shoop.admin.modules.products.views.edit_package.
ProductPackageViewToolbar
(view)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductParentBaseToolbar
-
class
shoop.admin.modules.products.views.edit_package.
ProductPackageView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductParentBaseView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/products/package/edit.jinja'¶
-
form_part_classes
= [<class 'shoop.admin.modules.products.views.edit_package.ProductChildrenFormPart'>]¶
-
toolbar_class
¶ alias of
ProductPackageViewToolbar
-
-
class
shoop.admin.modules.products.views.edit_parent.
ProductChildrenBaseFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
invalid_modes
= []¶
-
priority
= 0¶
-
form_name
= None¶
-
-
class
shoop.admin.modules.products.views.edit_parent.
ProductParentBaseToolbar
(view)[source]¶ Bases:
shoop.admin.toolbar.Toolbar
-
class
shoop.admin.modules.products.views.edit_parent.
ProductParentBaseView
(**kwargs)[source]¶ Bases:
shoop.admin.form_part.FormPartsViewMixin
,django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Product
-
context_object_name
= 'product'¶
-
form_class
¶ alias of
Form
-
form_part_classes
= []¶
-
toolbar_class
= None¶
-
-
class
shoop.admin.modules.products.views.edit_variation.
VariationChildrenFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductChildrenBaseFormPart
-
invalid_modes
= [<ProductMode.VARIATION_CHILD: 4>, <ProductMode.PACKAGE_PARENT: 1>]¶
-
priority
= 0¶
-
-
class
shoop.admin.modules.products.views.edit_variation.
VariationVariablesFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
form_def_name
= 'variables'¶
-
priority
= 1¶
-
-
class
shoop.admin.modules.products.views.edit_variation.
ProductVariationViewToolbar
(view)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductParentBaseToolbar
-
class
shoop.admin.modules.products.views.edit_variation.
ProductVariationView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductParentBaseView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/products/variation/edit.jinja'¶
-
form_part_classes
= [<class 'shoop.admin.modules.products.views.edit_variation.VariationChildrenFormPart'>, <class 'shoop.admin.modules.products.views.edit_variation.VariationVariablesFormPart'>]¶
-
toolbar_class
¶ alias of
ProductVariationViewToolbar
-
-
class
shoop.admin.modules.products.views.list.
ProductListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Product
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2098cf8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c128>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c860>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c160>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208cef0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c2e8>]¶
-
-
class
shoop.admin.modules.products.views.toolbars.
EditProductToolbar
(view)[source]¶ Bases:
shoop.admin.toolbar.Toolbar
-
class
shoop.admin.modules.products.views.
ProductCrossSellEditView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2098cf8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c128>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c860>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c160>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208cef0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d208c2e8>]¶
-
model
¶ alias of
Product
-
-
class
shoop.admin.modules.products.views.
ProductPackageView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductParentBaseView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_part_classes
= [<class 'shoop.admin.modules.products.views.edit_package.ProductChildrenFormPart'>]¶
-
template_name
= 'shoop/admin/products/package/edit.jinja'¶
-
toolbar_class
¶ alias of
ProductPackageViewToolbar
-
-
class
shoop.admin.modules.products.views.
ProductVariationView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.products.views.edit_parent.ProductParentBaseView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_part_classes
= [<class 'shoop.admin.modules.products.views.edit_variation.VariationChildrenFormPart'>, <class 'shoop.admin.modules.products.views.edit_variation.VariationVariablesFormPart'>]¶
-
template_name
= 'shoop/admin/products/variation/edit.jinja'¶
-
toolbar_class
¶ alias of
ProductVariationViewToolbar
-
-
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.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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.sales_units.views.edit.
SalesUnitForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
SalesUnitForm.
base_fields
= OrderedDict([('decimals', <django.forms.fields.IntegerField object at 0x7ff3d196a2e8>), ('name', <django.forms.fields.CharField object at 0x7ff3d197fac8>), ('short_name', <django.forms.fields.CharField object at 0x7ff3d1a7d8d0>)])¶
-
SalesUnitForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d197fac8>), ('short_name', <django.forms.fields.CharField object at 0x7ff3d1a7d8d0>)])¶
-
SalesUnitForm.
media
¶
-
-
class
shoop.admin.modules.sales_units.views.edit.
SalesUnitEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
SalesUnit
-
form_class
¶ alias of
SalesUnitForm
-
template_name
= 'shoop/admin/sales_units/edit.jinja'¶
-
context_object_name
= 'sales_unit'¶
-
-
class
shoop.admin.modules.sales_units.views.list.
SalesUnitListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
SalesUnit
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d18dd3c8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d18dd550>, <shoop.admin.utils.picotable.Column object at 0x7ff3d196e400>]¶
-
-
class
shoop.admin.modules.sales_units.views.
SalesUnitEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'sales_unit'¶
-
form_class
¶ alias of
SalesUnitForm
-
model
¶ alias of
SalesUnit
-
template_name
= 'shoop/admin/sales_units/edit.jinja'¶
-
-
class
shoop.admin.modules.sales_units.views.
SalesUnitListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d18dd3c8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d18dd550>, <shoop.admin.utils.picotable.Column object at 0x7ff3d196e400>]¶
-
model
¶ alias of
SalesUnit
-
-
class
shoop.admin.modules.service_providers.views.
ServiceProviderDeleteView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.DeleteView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ServiceProvider
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.service_providers.views.
ServiceProviderEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
add_form_errors_as_messages
= True¶
-
context_object_name
= 'service_provider'¶
-
form_class
¶ alias of
Form
-
form_provide_key
= 'service_provider_admin_form'¶
-
model
¶ alias of
ServiceProvider
-
template_name
= 'shoop/admin/service_providers/edit.jinja'¶
-
title
¶
-
-
class
shoop.admin.modules.service_providers.views.
ServiceProviderListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d190bf28>, <shoop.admin.utils.picotable.Column object at 0x7ff3d190b7f0>]¶
-
model
¶ alias of
ServiceProvider
-
-
class
shoop.admin.modules.service_providers.forms.
CustomCarrierForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
CustomCarrierForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7ff3d187e0f0>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d20362b0>), ('name', <django.forms.fields.CharField object at 0x7ff3d1877080>)])¶
-
CustomCarrierForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d1877080>)])¶
-
CustomCarrierForm.
media
¶
-
-
class
shoop.admin.modules.service_providers.forms.
CustomPaymentProcessorForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
CustomPaymentProcessorForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7ff3d187e748>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d187e7f0>), ('name', <django.forms.fields.CharField object at 0x7ff3d187e048>)])¶
-
CustomPaymentProcessorForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d187e048>)])¶
-
CustomPaymentProcessorForm.
media
¶
-
-
class
shoop.admin.modules.services.views.
PaymentMethodDeleteView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.DeleteView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
PaymentMethod
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.services.views.
PaymentMethodEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.services.views._edit.ServiceEditView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
base_form_part_classes
= [<class 'shoop.admin.modules.services.base_form_part.PaymentMethodBaseFormPart'>]¶
-
model
¶ alias of
PaymentMethod
-
-
class
shoop.admin.modules.services.views.
PaymentMethodListView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.services.views._list.ServiceListView
-
model
¶ alias of
PaymentMethod
-
-
class
shoop.admin.modules.services.views.
ShippingMethodDeleteView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.DeleteView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ShippingMethod
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.services.views.
ShippingMethodEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.services.views._edit.ServiceEditView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
base_form_part_classes
= [<class 'shoop.admin.modules.services.base_form_part.ShippingMethodBaseFormPart'>]¶
-
model
¶ alias of
ShippingMethod
-
-
class
shoop.admin.modules.services.base_form_part.
ServiceBaseFormPart
(*args, **kwargs)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= -1000¶
-
form
= None¶
-
-
class
shoop.admin.modules.services.base_form_part.
ShippingMethodBaseFormPart
(*args, **kwargs)[source]¶ Bases:
shoop.admin.modules.services.base_form_part.ServiceBaseFormPart
-
form
¶ alias of
ShippingMethodForm
-
-
class
shoop.admin.modules.services.base_form_part.
PaymentMethodBaseFormPart
(*args, **kwargs)[source]¶ Bases:
shoop.admin.modules.services.base_form_part.ServiceBaseFormPart
-
form
¶ alias of
PaymentMethodForm
-
-
class
shoop.admin.modules.services.behavior_form_part.
BehaviorFormSet
(*args, **kwargs)[source]¶ Bases:
django.forms.models.BaseModelFormSet
-
model
¶ alias of
ServiceBehaviorComponent
-
validate_min
= False¶
-
min_num
= 0¶
-
validate_max
= False¶
-
max_num
= 20¶
-
absolute_max
= 20¶
-
can_delete
= True¶
-
can_order
= False¶
-
extra
= 0¶
-
form_class
= None¶
-
-
class
shoop.admin.modules.services.behavior_form_part.
BehaviorComponentFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
formset
¶ alias of
BehaviorFormSet
-
template_name
= 'shoop/admin/services/_edit_behavior_components_form.jinja'¶
-
-
class
shoop.admin.modules.services.forms.
BaseMethodForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
class
Meta
[source]¶ Bases:
object
-
model
= None¶
-
exclude
= ['identifier', 'behavior_components', 'old_module_identifier', 'old_module_data']¶
-
base_fields
= ['choice_identifier', 'name', 'description', 'enabled', 'shop', 'logo', 'tax_class']¶
-
-
BaseMethodForm.
service_provider
¶
-
BaseMethodForm.
base_fields
= OrderedDict()¶
-
BaseMethodForm.
declared_fields
= OrderedDict()¶
-
BaseMethodForm.
media
¶
-
class
-
class
shoop.admin.modules.services.forms.
AlwaysChangedModelForm
(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
ModelForm that can be saved if it is empty or has unchanged lines on creation
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.admin.modules.services.forms.
ShippingMethodForm
(**kwargs)[source]¶ Bases:
shoop.admin.modules.services.forms.BaseMethodForm
-
service_provider_attr
= 'carrier'¶
-
class
Meta
[source]¶ Bases:
shoop.admin.modules.services.forms.Meta
-
model
¶ alias of
ShippingMethod
-
fields
= ['carrier', 'choice_identifier', 'name', 'description', 'enabled', 'shop', 'logo', 'tax_class']¶
-
help_texts
= {'carrier': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d19a49b0>}¶
-
-
ShippingMethodForm.
base_fields
= OrderedDict([('carrier', <django.forms.models.ModelChoiceField object at 0x7ff3d1981c50>), ('choice_identifier', <django.forms.fields.CharField object at 0x7ff3d196b400>), ('name', <django.forms.fields.CharField object at 0x7ff3d1c65898>), ('description', <django.forms.fields.CharField object at 0x7ff3d196e828>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3d198f6d8>), ('shop', <django.forms.models.ModelChoiceField object at 0x7ff3d198f588>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d198f668>), ('tax_class', <django.forms.models.ModelChoiceField object at 0x7ff3d19a4f98>)])¶
-
ShippingMethodForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d1c65898>), ('description', <django.forms.fields.CharField object at 0x7ff3d196e828>)])¶
-
ShippingMethodForm.
media
¶
-
-
class
shoop.admin.modules.services.forms.
PaymentMethodForm
(**kwargs)[source]¶ Bases:
shoop.admin.modules.services.forms.BaseMethodForm
-
service_provider_attr
= 'payment_processor'¶
-
class
Meta
[source]¶ Bases:
shoop.admin.modules.services.forms.Meta
-
model
¶ alias of
PaymentMethod
-
fields
= ['payment_processor', 'choice_identifier', 'name', 'description', 'enabled', 'shop', 'logo', 'tax_class']¶
-
help_texts
= {'payment_processor': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d19764e0>}¶
-
-
PaymentMethodForm.
base_fields
= OrderedDict([('payment_processor', <django.forms.models.ModelChoiceField object at 0x7ff3d1981668>), ('choice_identifier', <django.forms.fields.CharField object at 0x7ff3d1912f98>), ('name', <django.forms.fields.CharField object at 0x7ff3d185b208>), ('description', <django.forms.fields.CharField object at 0x7ff3d19a4fd0>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3d19a4ac8>), ('shop', <django.forms.models.ModelChoiceField object at 0x7ff3d19a45f8>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d1981518>), ('tax_class', <django.forms.models.ModelChoiceField object at 0x7ff3d1981f28>)])¶
-
PaymentMethodForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d185b208>), ('description', <django.forms.fields.CharField object at 0x7ff3d19a4fd0>)])¶
-
PaymentMethodForm.
media
¶
-
-
class
shoop.admin.modules.services.forms.
FixedCostBehaviorComponentForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
FixedCostBehaviorComponent
-
exclude
= ['identifier']¶
-
labels
= {'price_value': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d19a4898>}¶
-
-
FixedCostBehaviorComponentForm.
base_fields
= OrderedDict([('price_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1999cf8>), ('description', <django.forms.fields.CharField object at 0x7ff3d1976978>)])¶
-
FixedCostBehaviorComponentForm.
declared_fields
= OrderedDict([('description', <django.forms.fields.CharField object at 0x7ff3d1976978>)])¶
-
FixedCostBehaviorComponentForm.
media
¶
-
class
-
class
shoop.admin.modules.services.forms.
WaivingCostBehaviorComponentForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
WaivingCostBehaviorComponent
-
exclude
= ['identifier']¶
-
labels
= {'price_value': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d1999fd0>, 'waive_limit_value': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d1999c88>}¶
-
-
WaivingCostBehaviorComponentForm.
base_fields
= OrderedDict([('price_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1999eb8>), ('waive_limit_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1999f28>), ('description', <django.forms.fields.CharField object at 0x7ff3d1999588>)])¶
-
WaivingCostBehaviorComponentForm.
declared_fields
= OrderedDict([('description', <django.forms.fields.CharField object at 0x7ff3d1999588>)])¶
-
WaivingCostBehaviorComponentForm.
media
¶
-
class
-
class
shoop.admin.modules.services.forms.
WeightLimitsBehaviorComponentForm
(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
-
model
¶ alias of
WeightLimitsBehaviorComponent
-
exclude
= ['identifier']¶
-
-
WeightLimitsBehaviorComponentForm.
base_fields
= OrderedDict([('min_weight', <django.forms.fields.DecimalField object at 0x7ff3d1999198>), ('max_weight', <django.forms.fields.DecimalField object at 0x7ff3d1999d30>)])¶
-
WeightLimitsBehaviorComponentForm.
declared_fields
= OrderedDict()¶
-
WeightLimitsBehaviorComponentForm.
media
¶
-
class
-
class
shoop.admin.modules.services.forms.
GroupAvailabilityBehaviorComponentForm
(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
-
model
¶ alias of
GroupAvailabilityBehaviorComponent
-
exclude
= ['identifier']¶
-
-
GroupAvailabilityBehaviorComponentForm.
base_fields
= OrderedDict([('groups', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1999128>)])¶
-
GroupAvailabilityBehaviorComponentForm.
declared_fields
= OrderedDict()¶
-
GroupAvailabilityBehaviorComponentForm.
media
¶
-
class
-
class
shoop.admin.modules.services.forms.
StaffOnlyBehaviorComponentForm
(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:
shoop.admin.modules.services.forms.AlwaysChangedModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
StaffOnlyBehaviorComponent
-
exclude
= ['identifier']¶
-
-
StaffOnlyBehaviorComponentForm.
base_fields
= OrderedDict()¶
-
StaffOnlyBehaviorComponentForm.
declared_fields
= OrderedDict()¶
-
StaffOnlyBehaviorComponentForm.
media
¶
-
class
-
class
shoop.admin.modules.services.forms.
RoundingBehaviorComponentForm
(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:
shoop.admin.modules.services.forms.AlwaysChangedModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
RoundingBehaviorComponent
-
exclude
= ['identifier']¶
-
-
RoundingBehaviorComponentForm.
base_fields
= OrderedDict([('quant', <django.forms.fields.DecimalField object at 0x7ff3d19999b0>), ('mode', <enumfields.forms.EnumChoiceField object at 0x7ff3d1999d68>)])¶
-
RoundingBehaviorComponentForm.
declared_fields
= OrderedDict()¶
-
RoundingBehaviorComponentForm.
media
¶
-
class
-
class
shoop.admin.modules.services.
ServiceModule
[source]¶ Bases:
shoop.admin.base.AdminModule
-
category
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
model
= None¶
-
name
= None¶
-
url_prefix
= None¶
-
view_template
= None¶
-
name_template
= None¶
-
url_name_prefix
= None¶
-
-
class
shoop.admin.modules.services.
ShippingMethodModule
[source]¶ Bases:
shoop.admin.modules.services.ServiceModule
-
model
¶ alias of
ShippingMethod
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
url_prefix
= '^shipping_methods'¶
-
view_template
= 'shoop.admin.modules.services.views.ShippingMethod%sView'¶
-
name_template
= 'shipping_methods.%s'¶
-
url_name_prefix
= 'shoop_admin:shipping_methods'¶
-
-
class
shoop.admin.modules.services.
PaymentMethodModule
[source]¶ Bases:
shoop.admin.modules.services.ServiceModule
-
model
¶ alias of
PaymentMethod
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
url_prefix
= '^payment_methods'¶
-
view_template
= 'shoop.admin.modules.services.views.PaymentMethod%sView'¶
-
name_template
= 'payment_methods.%s'¶
-
url_name_prefix
= 'shoop_admin:payment_methods'¶
-
-
class
shoop.admin.modules.shops.views.edit.
ShopBaseForm
(**kwargs)[source]¶ Bases:
shoop.core.utils.form_mixins.ProtectedFieldsMixin
,shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
change_protect_field_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
Shop
-
exclude
= ('owner', 'options', 'contact_address')¶
-
-
ShopBaseForm.
base_fields
= OrderedDict([('domain', <django.forms.fields.CharField object at 0x7ff3d1b5ef98>), ('status', <enumfields.forms.EnumChoiceField object at 0x7ff3d1a7d710>), ('currency', <django.forms.fields.CharField object at 0x7ff3d21e6e10>), ('prices_include_tax', <django.forms.fields.BooleanField object at 0x7ff3d1d800b8>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d2967518>), ('maintenance_mode', <django.forms.fields.BooleanField object at 0x7ff3d2967240>), ('name', <django.forms.fields.CharField object at 0x7ff3d16f8160>), ('public_name', <django.forms.fields.CharField object at 0x7ff3d21e6908>), ('maintenance_message', <django.forms.fields.CharField object at 0x7ff3d21e6438>)])¶
-
ShopBaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d16f8160>), ('public_name', <django.forms.fields.CharField object at 0x7ff3d21e6908>), ('maintenance_message', <django.forms.fields.CharField object at 0x7ff3d21e6438>)])¶
-
ShopBaseForm.
media
¶
-
-
class
shoop.admin.modules.shops.views.edit.
ShopBaseFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= 1¶
-
-
class
shoop.admin.modules.shops.views.edit.
ContactAddressForm
(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
-
model
¶ alias of
MutableAddress
-
fields
= ('prefix', 'name', 'suffix', 'name_ext', 'phone', 'email', 'street', 'street2', 'street3', 'postal_code', 'city', 'region_code', 'region', 'country')¶
-
-
ContactAddressForm.
base_fields
= OrderedDict([('prefix', <django.forms.fields.CharField object at 0x7ff3d2967128>), ('name', <django.forms.fields.CharField object at 0x7ff3d2967278>), ('suffix', <django.forms.fields.CharField object at 0x7ff3d1a9c5f8>), ('name_ext', <django.forms.fields.CharField object at 0x7ff3d1a9cf28>), ('phone', <django.forms.fields.CharField object at 0x7ff3d1aa8f60>), ('email', <django.forms.fields.EmailField object at 0x7ff3d1aa8c88>), ('street', <django.forms.fields.CharField object at 0x7ff3d1aa89e8>), ('street2', <django.forms.fields.CharField object at 0x7ff3d1aa8630>), ('street3', <django.forms.fields.CharField object at 0x7ff3d1aa8240>), ('postal_code', <django.forms.fields.CharField object at 0x7ff3d1aa85c0>), ('city', <django.forms.fields.CharField object at 0x7ff3d1aa8dd8>), ('region_code', <django.forms.fields.CharField object at 0x7ff3d1aa8fd0>), ('region', <django.forms.fields.CharField object at 0x7ff3d1a84f60>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7ff3d1a84240>)])¶
-
ContactAddressForm.
declared_fields
= OrderedDict()¶
-
ContactAddressForm.
media
¶
-
class
-
class
shoop.admin.modules.shops.views.edit.
ContactAddressFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= 2¶
-
-
class
shoop.admin.modules.shops.views.edit.
ShopEditView
(**kwargs)[source]¶ Bases:
shoop.admin.form_part.SaveFormPartsMixin
,shoop.admin.form_part.FormPartsViewMixin
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Shop
-
template_name
= 'shoop/admin/shops/edit.jinja'¶
-
context_object_name
= 'shop'¶
-
base_form_part_classes
= [<class 'shoop.admin.modules.shops.views.edit.ShopBaseFormPart'>, <class 'shoop.admin.modules.shops.views.edit.ContactAddressFormPart'>]¶
-
form_part_class_provide_key
= 'admin_shop_form_part'¶
-
-
class
shoop.admin.modules.shops.views.list.
ShopListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Shop
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d1e22b70>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1e226a0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1720160>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1e22d30>]¶
-
-
class
shoop.admin.modules.shops.views.
ShopEditView
(**kwargs)[source]¶ Bases:
shoop.admin.form_part.SaveFormPartsMixin
,shoop.admin.form_part.FormPartsViewMixin
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
base_form_part_classes
= [<class 'shoop.admin.modules.shops.views.edit.ShopBaseFormPart'>, <class 'shoop.admin.modules.shops.views.edit.ContactAddressFormPart'>]¶
-
context_object_name
= 'shop'¶
-
form_part_class_provide_key
= 'admin_shop_form_part'¶
-
model
¶ alias of
Shop
-
template_name
= 'shoop/admin/shops/edit.jinja'¶
-
-
class
shoop.admin.modules.shops.views.
ShopListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d1e22b70>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1e226a0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1720160>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1e22d30>]¶
-
model
¶ alias of
Shop
-
-
class
shoop.admin.modules.suppliers.views.edit.
SupplierForm
(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
-
model
¶ alias of
Supplier
-
exclude
= ('module_data',)¶
-
widgets
= {'module_identifier': <class 'django.forms.widgets.Select'>}¶
-
-
SupplierForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d1912898>), ('type', <enumfields.forms.EnumChoiceField object at 0x7ff3d1913f98>), ('stock_managed', <django.forms.fields.BooleanField object at 0x7ff3d21f9a20>), ('module_identifier', <django.forms.fields.CharField object at 0x7ff3d1d09ac8>)])¶
-
SupplierForm.
declared_fields
= OrderedDict()¶
-
SupplierForm.
media
¶
-
class
-
class
shoop.admin.modules.suppliers.views.edit.
SupplierEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Supplier
-
form_class
¶ alias of
SupplierForm
-
template_name
= 'shoop/admin/suppliers/edit.jinja'¶
-
context_object_name
= 'supplier'¶
-
-
class
shoop.admin.modules.suppliers.views.list.
SupplierListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Supplier
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d1913630>, <shoop.admin.utils.picotable.Column object at 0x7ff3d19132b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1913550>]¶
-
-
class
shoop.admin.modules.suppliers.views.
SupplierEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
context_object_name
= 'supplier'¶
-
form_class
¶ alias of
SupplierForm
-
model
¶ alias of
Supplier
-
template_name
= 'shoop/admin/suppliers/edit.jinja'¶
-
-
class
shoop.admin.modules.suppliers.views.
SupplierListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d1913630>, <shoop.admin.utils.picotable.Column object at 0x7ff3d19132b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1913550>]¶
-
model
¶ alias of
Supplier
-
-
class
shoop.admin.modules.system.views.telemetry.
TelemetryView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/system/telemetry.jinja'¶
-
-
class
shoop.admin.modules.taxes.views.edit.
TaxForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
Tax
-
fields
= ['name', 'code', 'rate', 'amount_value', 'currency', 'enabled']¶
-
-
TaxForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d15d04a8>), ('code', <django.forms.fields.CharField object at 0x7ff3d15d0390>), ('rate', <shoop.admin.forms.fields.PercentageField object at 0x7ff3d15d0780>), ('amount_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d19f94a8>), ('currency', <django.forms.fields.CharField object at 0x7ff3d15d0e48>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3d15d0f60>)])¶
-
TaxForm.
declared_fields
= OrderedDict([('rate', <shoop.admin.forms.fields.PercentageField object at 0x7ff3d15d0780>), ('name', <django.forms.fields.CharField object at 0x7ff3d15d04a8>)])¶
-
TaxForm.
media
¶
-
class
-
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 0x7ff3d15d0160>)])¶
-
CustomerTaxGroupForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d15d0160>)])¶
-
CustomerTaxGroupForm.
media
¶
-
-
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 0x7ff3d15de0b8>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3d18be0f0>)])¶
-
TaxClassForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d15de0b8>)])¶
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Tax
-
template_name
= 'shoop/admin/taxes/edit_tax.jinja'¶
-
context_object_name
= 'tax'¶
-
add_form_errors_as_messages
= True¶
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:tax.list'¶
-
-
class
shoop.admin.modules.taxes.views.edit.
CustomerTaxGroupEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
CustomerTaxGroup
-
form_class
¶ alias of
CustomerTaxGroupForm
-
template_name
= 'shoop/admin/taxes/edit_customer_tax_group.jinja'¶
-
context_object_name
= 'customer_tax_group'¶
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:customer_tax_group.list'¶
-
-
class
shoop.admin.modules.taxes.views.edit.
TaxClassEditView
(**kwargs)[source]¶ Bases:
shoop.admin.modules.taxes.views.edit._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
TaxClass
-
template_name
= 'shoop/admin/taxes/edit_tax_class.jinja'¶
-
form_class
¶ alias of
TaxClassForm
-
context_object_name
= 'tax_class'¶
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:tax_class.list'¶
-
-
class
shoop.admin.modules.taxes.views.list.
TaxListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Tax
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d15de438>, <shoop.admin.utils.picotable.Column object at 0x7ff3d15de4a8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d15de518>, <shoop.admin.utils.picotable.Column object at 0x7ff3d15de588>]¶
-
-
class
shoop.admin.modules.taxes.views.list.
CustomerTaxGroupListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
CustomerTaxGroup
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d15de630>]¶
-
-
class
shoop.admin.modules.taxes.views.list.
TaxClassListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
TaxClass
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d15de710>]¶
-
-
class
shoop.admin.modules.taxes.views.
TaxClassListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d15de710>]¶
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d15de438>, <shoop.admin.utils.picotable.Column object at 0x7ff3d15de4a8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d15de518>, <shoop.admin.utils.picotable.Column object at 0x7ff3d15de588>]¶
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d15de630>]¶
-
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 0x7ff3d2acb780>), ('permission_info', <django.forms.fields.CharField object at 0x7ff3d2acb630>), ('permission_groups', <django.forms.fields.CharField object at 0x7ff3d2acb0f0>)])¶
-
declared_fields
= OrderedDict([('password', <django.forms.fields.CharField object at 0x7ff3d2acb780>), ('permission_info', <django.forms.fields.CharField object at 0x7ff3d2acb630>), ('permission_groups', <django.forms.fields.CharField object at 0x7ff3d2acb0f0>)])¶
-
media
¶
-
-
class
shoop.admin.modules.users.views.detail.
UserDetailToolbar
(view)[source]¶ Bases:
shoop.admin.toolbar.Toolbar
-
class
shoop.admin.modules.users.views.detail.
UserDetailView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/users/detail.jinja'¶
-
context_object_name
= 'user'¶
-
fields
= ('username', 'email', 'first_name', 'last_name')¶
-
-
class
shoop.admin.modules.users.views.list.
UserListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
= 'auth.User'¶
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2acbda0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acbe10>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acb1d0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acbb00>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acbba8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acb2b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acb978>]¶
-
-
class
shoop.admin.modules.users.views.password.
PasswordChangeForm
(changing_user, target_user, *args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
-
error_messages
= {'password_incorrect': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d2b3f128>, 'password_mismatch': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d2b3f0f0>}¶
-
base_fields
= OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7ff3d2b3fe80>), ('password1', <django.forms.fields.CharField object at 0x7ff3d2b3f940>), ('password2', <django.forms.fields.CharField object at 0x7ff3d2b3f9e8>)])¶
-
declared_fields
= OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7ff3d2b3fe80>), ('password1', <django.forms.fields.CharField object at 0x7ff3d2b3f940>), ('password2', <django.forms.fields.CharField object at 0x7ff3d2b3f9e8>)])¶
-
media
¶
-
-
class
shoop.admin.modules.users.views.password.
UserChangePasswordView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
PasswordChangeForm
-
template_name
= 'shoop/admin/users/change_password.jinja'¶
-
model
= 'auth.User'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.users.views.password.
UserResetPasswordView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
= 'auth.User'¶
-
template_name
= 'shoop/admin/users/reset_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 0x7ff3d2b03ac8>)])¶
-
declared_fields
= OrderedDict([('old_password', <django.forms.fields.CharField object at 0x7ff3d2b03ac8>)])¶
-
media
¶
-
-
class
shoop.admin.modules.users.views.permissions.
UserChangePermissionsView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/users/change_permissions.jinja'¶
-
model
= 'auth.User'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.users.views.
UserListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d2acbda0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acbe10>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acb1d0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acbb00>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acbba8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acb2b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d2acb978>]¶
-
model
= 'auth.User'¶
-
-
class
shoop.admin.modules.users.views.
UserDetailView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
= 'auth.User'¶
-
template_name
= 'shoop/admin/users/reset_password.jinja'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.admin.modules.users.views.
UserChangePermissionsView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
= 'auth.User'¶
-
template_name
= 'shoop/admin/users/change_permissions.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.
filter_form_field_choices
(field, predicate, invert=False)[source]¶ Filter choices of a form field and its widget by predicate.
The predicate may be a callable of the signature
(pair) -> bool
or an iterable of allowable values.Parameters: - field (django.forms.Field) – Form field.
- predicate (function|Iterable) – Predicate
- invert (bool) – Invert the semantics of the predicate, i.e. items matching it will be rejected.
Returns: Nothing. The field is modified in-place.
-
shoop.admin.utils.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.permissions.
get_default_model_permissions
(model)[source]¶ Return a set of all default permissions for a given model.
Parameters: model (django.db.Model) – Model class Returns: Set of default model permissions as strings Return type: set[str]
-
shoop.admin.utils.permissions.
get_missing_permissions
(user, permissions)[source]¶ Return a set of missing permissions for a given iterable of permission strings.
Parameters: - user (django.contrib.auth.models.User) – User instance to check for permissions
- permissions (Iterable[str]) – Iterable of permission strings
Returns: Set of missing permission strings
Return type: set[str]
-
shoop.admin.utils.permissions.
get_permissions_from_urls
(urls)[source]¶ Return a set of permissions for a given iterable of urls.
Parameters: urls (Iterable[django.core.urlresolvers.RegexURLPattern]) – Iterable of url objects to check for permissions Returns: Set of permissions for urls as strings Return type: set[str]
-
shoop.admin.utils.permissions.
get_permission_object_from_string
(permission_string)[source]¶ Given a permission string of the form
app_label.permission_string
, get actual permission object.Parameters: permission_string – Permission string Returns: Permission object Return type: django.contrib.auth.models.Permission
-
shoop.admin.utils.picotable.
maybe_callable
(thing, context=None)[source]¶ If
thing
is callable, return it. Ifthing
names a callable attribute ofcontext
, return it.
-
shoop.admin.utils.picotable.
maybe_call
(thing, context, args=None, kwargs=None)[source]¶ If
thing
is callable, call it with args and kwargs and return the value. Ifthing
names a callable attribute ofcontext
, call it with args and kwargs and return the value. Otherwise returnthing
.
-
class
shoop.admin.utils.picotable.
ChoicesFilter
(choices=None, filter_field=None, default=None)[source]¶ Bases:
shoop.admin.utils.picotable.Filter
-
type
= 'choices'¶
-
-
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
Parameters: - filter_field (str|None) – Filter field (Django query expression). If None, column ID is used.
- min – Minimum value.
- max – Maximum value.
- step – Step value. See the HTML5 documentation for semantics.
- field_type (str|None) – Field type string. See the HTML5 documentation for semantics.
-
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
Parameters: - filter_field (str|None) – Filter field (Django query expression). If None, column ID is used.
- field_type (str|None) – Field type string. See the HTML5 documentation for semantics.
- placeholder (str|None) – Field placeholder string.
- operator (str) – Django operator for the queryset.
-
type
= 'text'¶
-
class
shoop.admin.utils.picotable.
MultiFieldTextFilter
(filter_fields, **kwargs)[source]¶ Bases:
shoop.admin.utils.picotable.TextFilter
Parameters: - filter_field (list<str>) – List of Filter fields (Django query expression).
- kwargs – Kwargs for
TextFilter
.
-
class
shoop.admin.utils.picotable.
Picotable
(request, columns, queryset, context)[source]¶ Bases:
object
-
class
shoop.admin.utils.picotable.
PicotableViewMixin
[source]¶ Bases:
object
-
columns
= []¶
-
template_name
= 'shoop/admin/base_picotable.jinja'¶
-
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]
-
-
class
shoop.admin.utils.urls.
AdminRegexURLPattern
(regex, callback, default_args=None, name=None, require_authentication=True, permissions=())[source]¶ Bases:
django.core.urlresolvers.RegexURLPattern
-
callback
¶
-
-
shoop.admin.utils.urls.
admin_url
(regex, view, kwargs=None, name=None, prefix='', require_authentication=True, permissions=())[source]¶
-
shoop.admin.utils.urls.
get_edit_and_list_urls
(url_prefix, view_template, name_template, permissions=())[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]
-
exception
shoop.admin.utils.urls.
NoModelUrl
[source]¶ Bases:
ValueError
-
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 failsParameters: - object (class) – Model or object class.
- kind (str) – URL kind. Currently “new”, “list”, “edit”, “detail”.
Returns: Resolved URL.
Return type:
-
shoop.admin.utils.urls.
derive_model_url
(model_class, urlname_prefix, object, kind)[source]¶ Try to guess a model URL for the given
object
andkind
.An utility for people implementing
get_model_url
.Parameters: - model_class (class) – The model class the object must be an instance or subclass of.
- urlname_prefix (str) – URLname prefix. For instance,
shoop_admin:product.
- object (django.db.models.Model|class) – The model or model class as passed to
get_model_url
- kind (str) – URL kind as passed to
get_model_url
.
Returns: Resolved URL or None.
Return type: str|None
-
shoop.admin.utils.urls.
get_model_front_url
(request, object)[source]¶ Get a frontend URL for an object.
Parameters: - request (HttpRequest) – Request
- object (django.db.models.Model) – A model instance
Returns: URL or None
Return type: str|None
-
class
shoop.admin.utils.views.
CreateOrUpdateView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
add_form_errors_as_messages
= False¶
-
-
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.utils.views.
PicotableListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.picotable.PicotableViewMixin
,django.views.generic.list.ListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
shoop.admin.views.dashboard.
DashboardView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/admin/dashboard/dashboard.jinja'¶
-
-
class
shoop.admin.views.search.
SearchView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
shoop.admin.base.
AdminModule
[source]¶ Bases:
object
-
name
= '_Base_'¶
Return type: dict[str,str]
Return type: list[shoop.admin.base.MenuEntry]
-
get_activity
(request, cutoff)[source]¶ Parameters: - cutoff (datetime.datetime) – Cutoff datetime
- request (django.http.request.HttpRequest) – Request
Returns: list[shoop.admin.base.Activity]
-
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
-
-
class
shoop.admin.base.
Resolvable
[source]¶ Bases:
object
-
url
¶ Resolve this object’s
_url
to an actual URL.Returns: URL or no URL. Return type: str|None
-
original_url
¶
-
-
class
shoop.admin.base.
MenuEntry
(text, url, icon=None, category=None, aliases=())[source]¶ Bases:
shoop.admin.base.Resolvable
-
class
shoop.admin.base.
SearchResult
(text, url, icon=None, category=None, is_action=False, relevance=100, target=None)[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
Parameters: - text (str) – The notification’s text.
- title (str|None) – An optional title for the notification.
- url (str|None) – The optional main URL for the notification.
- kind (str) – The kind of the notification (see KINDS)
- dismissal_url (str|None) – An optional dismissal URL for the notification. The admin framework will add a button that will cause an AJAX post into this URL.
- datetime (datetime) – An optional date+time for this notification.
-
KINDS
= ('info', 'success', 'warning', 'danger')¶
-
class
shoop.admin.base.
Activity
(datetime, text, url=None)[source]¶ Bases:
shoop.admin.base.Resolvable
-
class
shoop.admin.base.
OrderSection
[source]¶ Bases:
object
Subclass this and add the class to the
admin_order_section
provide list to show a custom section on the order detail on admin.identifier
must be uniquename
the section captionicon
the section icontemplate
the section template fileextra_js
the section extra javascript template file,set a file which contains js code inside a <script> tagorder
the order-
identifier
= ''¶
-
name
= ''¶
-
icon
= ''¶
-
template
= ''¶
-
extra_js
= ''¶
-
order
= 0¶
-
Bases:
object
Infer breadcrumbs from the rendering context.
Parameters: context (jinja2.runtime.Context) – Jinja Context Returns: Breadcrumbs object or None if things fail Return type: Breadcrumbs|None
-
class
shoop.admin.currencybound.
CurrencyBound
(currency=None, *args, **kwargs)[source]¶ Bases:
object
Mixin for adding currency property defaulting currency of the first Shop.
The currency property is “lazy” so that database is not accessed on initialization, since this mixin will be used by some
AdminModule
classes and they will be initialized at import time bymodule_registry.register
(which is called at import becauseadmin.urls
callsget_module_urls
at import).-
currency
¶
-
-
class
shoop.admin.form_part.
TemplatedFormDef
(name, form_class, template_name, required=True, kwargs=None)[source]¶
-
shoop.admin.module_registry.
replace_modules
(new_module_classes)[source]¶ Context manager to temporarily replace all modules with something else.
Test utility, mostly.
>>> def some_test(): ... with replace_modules(["foo.bar:QuuxModule"]): ... pass # do stuff
Parameters: new_module_classes – Iterable of module classes, like you’d pass to register
-
class
shoop.admin.toolbar.
BaseActionButton
(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default')[source]¶ Bases:
object
Parameters: - text – The actual text for the button.
- icon – Icon CSS class string
- disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
- tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
- extra_css_class (str) – Extra CSS class(es)
-
base_css_classes
= ('btn',)¶
-
class
shoop.admin.toolbar.
URLActionButton
(url, **kwargs)[source]¶ Bases:
shoop.admin.toolbar.BaseActionButton
An action button that renders as a link leading to
url
.Parameters: url (str) – The URL to navigate to. For convenience, if this contains no slashes, reverse
is automatically called on it.
-
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.
JavaScriptActionButton
(onclick, **kwargs)[source]¶ Bases:
shoop.admin.toolbar.BaseActionButton
An action button that uses
onclick
for action dispatch.
-
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
topost_url
.
-
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.
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.
DropdownDivider
(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default')[source]¶ Bases:
shoop.admin.toolbar.BaseActionButton
A Divider for DropdownActionButtons.
Parameters: - text – The actual text for the button.
- icon – Icon CSS class string
- disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
- tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
- extra_css_class (str) – Extra CSS class(es)
-
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.
Parameters: - text – The actual text for the button.
- icon – Icon CSS class string
- disable_reason (str|None) – The reason for this button to be disabled. It’s considered good UX to have an user-visible reason for disabled actions; thus the only way to disable an action is to set the reason. See http://stackoverflow.com/a/372503/51685.
- tooltip (str|None) – Tooltip string, if any. May be replaced by the disable reason.
- extra_css_class (str) – Extra CSS class(es)
-
base_css_classes
= ()¶
-
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
-
name
= 'shoop.admin'¶
-
verbose_name
= 'Shoop Admin'¶
-
label
= 'shoop_admin'¶
-
required_installed_apps
= ['bootstrap3']¶
-
provides
= {'service_behavior_component_form': ['shoop.admin.modules.services.forms:FixedCostBehaviorComponentForm', 'shoop.admin.modules.services.forms:WaivingCostBehaviorComponentForm', 'shoop.admin.modules.services.forms:WeightLimitsBehaviorComponentForm', 'shoop.admin.modules.services.forms:GroupAvailabilityBehaviorComponentForm', 'shoop.admin.modules.services.forms.StaffOnlyBehaviorComponentForm', 'shoop.admin.modules.services.forms:RoundingBehaviorComponentForm'], 'service_provider_admin_form': ['shoop.admin.modules.service_providers.forms:CustomCarrierForm', 'shoop.admin.modules.service_providers.forms:CustomPaymentProcessorForm'], '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.permission_groups:PermissionGroupModule', 'shoop.admin.modules.users:UserModule', 'shoop.admin.modules.service_providers:ServiceProviderModule', 'shoop.admin.modules.services:PaymentMethodModule', 'shoop.admin.modules.services:ShippingMethodModule', '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'], 'admin_order_section': ['shoop.admin.modules.orders.sections:ContentsOrderSection', 'shoop.admin.modules.orders.sections:PaymentOrderSection', 'shoop.admin.modules.orders.sections:LogEntriesOrderSection'], 'service_behavior_component_form_part': ['shoop.admin.modules.services.weight_based_pricing.WeightBasedPricingFormPart']}¶
-
-
class
shoop.api.encoders.
ExtJSONEncoder
(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ Bases:
rest_framework.utils.encoders.JSONEncoder
Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped.
If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters.
If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place.
If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.
If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.
If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.
If specified, separators should be an (item_separator, key_separator) tuple. The default is (‘, ‘, ‘: ‘) if indent is
None
and (‘,’, ‘: ‘) otherwise. To get the most compact JSON representation, you should specify (‘,’, ‘:’) to eliminate whitespace.If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a
TypeError
.
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_specs_and_objects
(category)[source]¶ Get a mapping of provide specs (“x.y.z:Q”) to their loaded objects (<class Q>).
Parameters: category (str) – Category to load objects for Returns: Dict of spec -> object Return type: dict[str, object]
-
shoop.apps.provides.
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.
override_provides
(category, spec_list)[source]¶ Context manager to override
provides
for a given category.Useful for testing.
Parameters: - category (str) – Category name.
- spec_list (list[str]) – List of specs.
-
shoop.apps.provides.
load_module
(setting_name, provide_category)[source]¶ Load a module from a module setting.
The value of the setting must be a module identifier for the given provide category.
Parameters: Returns: An object.
Return type: Any
-
shoop.apps.provides.
load_modules
(setting_name, provide_category)[source]¶ Load a list of modules from a module setting.
The value of the setting must be a list of module identifiers for the given provide category.
The modules are returned in the same order they are declared in the settings.
Parameters: Returns: A list of objects
Return type: list[Any]
-
shoop.apps.provides.
load_module_instances
(setting_name, provide_category)[source]¶ Load a list of initialized modules from a module setting.
Basically does the same as
load_modules
, but also initializes the loaded modules by calling them.
-
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
orSHOOP_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 withSHOOP_FRONT
even though it is fromshoop.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
-
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.
-
provides
= {}¶ See The Provides system for details about the
provides
variable.
-
-
class
shoop.campaigns.admin_module.forms.
BasketCampaignForm
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseCampaignForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
BasketCampaign
-
-
BasketCampaignForm.
base_fields
= OrderedDict([('shop', <django.forms.models.ModelChoiceField object at 0x7ff3d1143668>), ('name', <django.forms.fields.CharField object at 0x7ff3d127f5f8>), ('active', <django.forms.fields.BooleanField object at 0x7ff3d127fe80>), ('start_datetime', <django.forms.fields.DateTimeField object at 0x7ff3d127f208>), ('end_datetime', <django.forms.fields.DateTimeField object at 0x7ff3d12079b0>), ('basket_line_text', <django.forms.fields.CharField object at 0x7ff3d1207828>), ('coupon', <django.forms.models.ModelChoiceField object at 0x7ff3d1207390>), ('public_name', <django.forms.fields.CharField object at 0x7ff3d127dba8>)])¶
-
BasketCampaignForm.
declared_fields
= OrderedDict([('public_name', <django.forms.fields.CharField object at 0x7ff3d127dba8>)])¶
-
BasketCampaignForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
BasketDiscountAmountForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseEffectModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
BasketDiscountAmount
-
-
BasketDiscountAmountForm.
base_fields
= OrderedDict([('campaign', <django.forms.models.ModelChoiceField object at 0x7ff3d131a2e8>), ('discount_amount', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d131aba8>)])¶
-
BasketDiscountAmountForm.
declared_fields
= OrderedDict()¶
-
BasketDiscountAmountForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
BasketDiscountPercentageForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseEffectModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
BasketDiscountPercentage
-
-
BasketDiscountPercentageForm.
base_fields
= OrderedDict([('campaign', <django.forms.models.ModelChoiceField object at 0x7ff3d131a630>), ('discount_percentage', <shoop.admin.forms.fields.PercentageField object at 0x7ff3d131aa58>)])¶
-
BasketDiscountPercentageForm.
declared_fields
= OrderedDict([('discount_percentage', <shoop.admin.forms.fields.PercentageField object at 0x7ff3d131aa58>)])¶
-
BasketDiscountPercentageForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
BasketMaxTotalAmountConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
BasketMaxTotalAmountCondition
-
-
BasketMaxTotalAmountConditionForm.
base_fields
= OrderedDict([('amount_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d131a9b0>)])¶
-
BasketMaxTotalAmountConditionForm.
declared_fields
= OrderedDict()¶
-
BasketMaxTotalAmountConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
BasketMaxTotalProductAmountConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
BasketMaxTotalProductAmountCondition
-
-
BasketMaxTotalProductAmountConditionForm.
base_fields
= OrderedDict([('product_count', <django.forms.fields.DecimalField object at 0x7ff3d1209a20>)])¶
-
BasketMaxTotalProductAmountConditionForm.
declared_fields
= OrderedDict()¶
-
BasketMaxTotalProductAmountConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
BasketTotalAmountConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
BasketTotalAmountCondition
-
-
BasketTotalAmountConditionForm.
base_fields
= OrderedDict([('amount_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1209208>)])¶
-
BasketTotalAmountConditionForm.
declared_fields
= OrderedDict()¶
-
BasketTotalAmountConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
BasketTotalProductAmountConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
BasketTotalProductAmountCondition
-
-
BasketTotalProductAmountConditionForm.
base_fields
= OrderedDict([('product_count', <django.forms.fields.DecimalField object at 0x7ff3d1209160>)])¶
-
BasketTotalProductAmountConditionForm.
declared_fields
= OrderedDict()¶
-
BasketTotalProductAmountConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
CatalogCampaignForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseCampaignForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
exclude
= ['identifier', 'created_by', 'modified_by', 'conditions', 'filters', 'coupon']¶
-
model
¶ alias of
CatalogCampaign
-
-
CatalogCampaignForm.
base_fields
= OrderedDict([('shop', <django.forms.models.ModelChoiceField object at 0x7ff3d127b5c0>), ('name', <django.forms.fields.CharField object at 0x7ff3d127b1d0>), ('active', <django.forms.fields.BooleanField object at 0x7ff3d127b518>), ('start_datetime', <django.forms.fields.DateTimeField object at 0x7ff3d1276358>), ('end_datetime', <django.forms.fields.DateTimeField object at 0x7ff3d1276dd8>), ('public_name', <django.forms.fields.CharField object at 0x7ff3d127f7b8>)])¶
-
CatalogCampaignForm.
declared_fields
= OrderedDict([('public_name', <django.forms.fields.CharField object at 0x7ff3d127f7b8>)])¶
-
CatalogCampaignForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
CategoryFilterForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
CategoryFilter
-
-
CategoryFilterForm.
base_fields
= OrderedDict([('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1a452e8>)])¶
-
CategoryFilterForm.
declared_fields
= OrderedDict()¶
-
CategoryFilterForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ContactBasketConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
ContactBasketCondition
-
-
ContactBasketConditionForm.
base_fields
= OrderedDict([('contacts', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1209470>)])¶
-
ContactBasketConditionForm.
declared_fields
= OrderedDict()¶
-
ContactBasketConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ContactConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
ContactCondition
-
-
ContactConditionForm.
base_fields
= OrderedDict([('contacts', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1276d30>)])¶
-
ContactConditionForm.
declared_fields
= OrderedDict()¶
-
ContactConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ContactGroupBasketConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
ContactGroupBasketCondition
-
-
ContactGroupBasketConditionForm.
base_fields
= OrderedDict([('contact_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d12093c8>)])¶
-
ContactGroupBasketConditionForm.
declared_fields
= OrderedDict()¶
-
ContactGroupBasketConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ContactGroupConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
ContactGroupCondition
-
-
ContactGroupConditionForm.
base_fields
= OrderedDict([('contact_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d12764a8>)])¶
-
ContactGroupConditionForm.
declared_fields
= OrderedDict()¶
-
ContactGroupConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
CouponForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
fields
= ['code', 'usage_limit_customer', 'usage_limit', 'active']¶
-
model
¶ alias of
Coupon
-
-
CouponForm.
base_fields
= OrderedDict([('code', <django.forms.fields.CharField object at 0x7ff3d1204588>), ('usage_limit_customer', <django.forms.fields.IntegerField object at 0x7ff3d12ef668>), ('usage_limit', <django.forms.fields.IntegerField object at 0x7ff3d12eff60>), ('active', <django.forms.fields.BooleanField object at 0x7ff3d12ef5f8>), ('autogenerate', <django.forms.fields.BooleanField object at 0x7ff3d2209860>)])¶
-
CouponForm.
declared_fields
= OrderedDict([('autogenerate', <django.forms.fields.BooleanField object at 0x7ff3d2209860>)])¶
-
CouponForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
DiscountFromProductForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseEffectModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
DiscountFromProduct
-
-
DiscountFromProductForm.
base_fields
= OrderedDict([('campaign', <django.forms.models.ModelChoiceField object at 0x7ff3d127bb38>), ('per_line_discount', <django.forms.fields.BooleanField object at 0x7ff3d131d668>), ('discount_amount', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d127b710>), ('products', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d127be48>)])¶
-
DiscountFromProductForm.
declared_fields
= OrderedDict()¶
-
DiscountFromProductForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
FreeProductLineForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseEffectModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
FreeProductLine
-
-
FreeProductLineForm.
base_fields
= OrderedDict([('campaign', <django.forms.models.ModelChoiceField object at 0x7ff3d131a358>), ('quantity', <django.forms.fields.IntegerField object at 0x7ff3d131a908>), ('products', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d131acf8>)])¶
-
FreeProductLineForm.
declared_fields
= OrderedDict()¶
-
FreeProductLineForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ProductDiscountAmountForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseEffectModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
exclude
= ['identifier', 'active']¶
-
model
¶ alias of
ProductDiscountAmount
-
-
ProductDiscountAmountForm.
base_fields
= OrderedDict([('campaign', <django.forms.models.ModelChoiceField object at 0x7ff3d1276780>), ('discount_amount', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d1276470>)])¶
-
ProductDiscountAmountForm.
declared_fields
= OrderedDict()¶
-
ProductDiscountAmountForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ProductDiscountPercentageForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseEffectModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
exclude
= ['identifier', 'active']¶
-
model
¶ alias of
ProductDiscountPercentage
-
-
ProductDiscountPercentageForm.
base_fields
= OrderedDict([('campaign', <django.forms.models.ModelChoiceField object at 0x7ff3d1276390>), ('discount_percentage', <shoop.admin.forms.fields.PercentageField object at 0x7ff3d12762e8>)])¶
-
ProductDiscountPercentageForm.
declared_fields
= OrderedDict([('discount_percentage', <shoop.admin.forms.fields.PercentageField object at 0x7ff3d12762e8>)])¶
-
ProductDiscountPercentageForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ProductFilterForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
ProductFilter
-
-
ProductFilterForm.
base_fields
= OrderedDict([('products', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1b2de10>)])¶
-
ProductFilterForm.
declared_fields
= OrderedDict()¶
-
ProductFilterForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ProductsInBasketConditionForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
ProductsInBasketCondition
-
-
ProductsInBasketConditionForm.
base_fields
= OrderedDict([('quantity', <django.forms.fields.IntegerField object at 0x7ff3d127db38>), ('products', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d1209cf8>)])¶
-
ProductsInBasketConditionForm.
declared_fields
= OrderedDict()¶
-
ProductsInBasketConditionForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.forms.
ProductTypeFilterForm
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.BaseRuleModelForm
-
class
Meta
[source]¶ Bases:
shoop.campaigns.admin_module.forms._base.Meta
-
model
¶ alias of
ProductTypeFilter
-
-
ProductTypeFilterForm.
base_fields
= OrderedDict([('product_types', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d2209da0>)])¶
-
ProductTypeFilterForm.
declared_fields
= OrderedDict()¶
-
ProductTypeFilterForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.views.
CatalogCampaignEditView
(**kwargs)[source]¶ Bases:
shoop.campaigns.utils._Breadcrumbed
,shoop.campaigns.admin_module.views._edit.CampaignEditView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
base_form_part_classes
= [<class 'shoop.campaigns.admin_module.form_parts.CatalogBaseFormPart'>]¶
-
condition_key
= 'campaign_context_condition'¶
-
effects
= [('campaign_product_discount_effect_form', <class 'shoop.campaigns.admin_module.form_parts.CatalogEffectsFormPart'>)]¶
-
filter_key
= 'campaign_catalog_filter'¶
-
model
¶ alias of
CatalogCampaign
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:catalog_campaigns.list'¶
-
rules_form_part_class
¶ alias of
CatalogConditionsFormPart
-
-
class
shoop.campaigns.admin_module.views.
CatalogCampaignListView
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.views._list.CampaignListView
-
model
¶ alias of
CatalogCampaign
-
-
class
shoop.campaigns.admin_module.views.
BasketCampaignEditView
(**kwargs)[source]¶ Bases:
shoop.campaigns.utils._Breadcrumbed
,shoop.campaigns.admin_module.views._edit.CampaignEditView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
base_form_part_classes
= [<class 'shoop.campaigns.admin_module.form_parts.BasketBaseFormPart'>]¶
-
condition_key
= 'campaign_basket_condition'¶
-
effects
= [('campaign_basket_discount_effect_form', <class 'shoop.campaigns.admin_module.form_parts.BasketDiscountEffectsFormPart'>), ('campaign_basket_line_effect_form', <class 'shoop.campaigns.admin_module.form_parts.BasketLineEffectsFormPart'>)]¶
-
model
¶ alias of
BasketCampaign
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:basket_campaigns.list'¶
-
rules_form_part_class
¶ alias of
BasketConditionsFormPart
-
-
class
shoop.campaigns.admin_module.views.
BasketCampaignListView
(**kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.views._list.CampaignListView
-
model
¶ alias of
BasketCampaign
-
-
class
shoop.campaigns.admin_module.views.
CouponEditView
(**kwargs)[source]¶ Bases:
shoop.campaigns.utils._Breadcrumbed
,shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
add_form_errors_as_messages
= True¶
-
context_object_name
= 'coupon'¶
-
form_class
¶ alias of
CouponForm
-
model
¶ alias of
Coupon
-
parent_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
parent_url
= 'shoop_admin:coupons.list'¶
-
template_name
= 'shoop/campaigns/admin/edit_coupons.jinja'¶
-
-
class
shoop.campaigns.admin_module.views.
CouponListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d0e28fd0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1fe4f98>, <shoop.admin.utils.picotable.Column object at 0x7ff3d1255e80>, <shoop.admin.utils.picotable.Column object at 0x7ff3d16098d0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d131c588>, <shoop.admin.utils.picotable.Column object at 0x7ff3d15249e8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d0e16400>]¶
-
model
¶ alias of
Coupon
-
-
class
shoop.campaigns.admin_module.form_parts.
SalesRangesForm
(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
ContactGroupSalesRange
-
fields
= ['min_value', 'max_value']¶
-
labels
= {'min_value': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d127da90>, 'max_value': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d127dc50>}¶
-
help_texts
= {'max_value': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d127d908>}¶
-
-
SalesRangesForm.
base_fields
= OrderedDict([('min_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d131d390>), ('max_value', <shoop.core.fields.FormattedDecimalFormField object at 0x7ff3d131d6a0>)])¶
-
SalesRangesForm.
declared_fields
= OrderedDict()¶
-
SalesRangesForm.
media
¶
-
class
-
class
shoop.campaigns.admin_module.form_parts.
SalesRangesFormPart
(request, object=None)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= 3¶
-
name
= 'contact_group_sales_ranges'¶
-
form
¶ alias of
SalesRangesForm
-
-
class
shoop.campaigns.admin_module.form_parts.
CampaignBaseFormPart
(*args, **kwargs)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
priority
= -1000¶
-
form
= None¶
-
-
class
shoop.campaigns.admin_module.form_parts.
CatalogBaseFormPart
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.CampaignBaseFormPart
-
form
¶ alias of
CatalogCampaignForm
-
-
class
shoop.campaigns.admin_module.form_parts.
BasketBaseFormPart
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.CampaignBaseFormPart
-
form
¶ alias of
BasketCampaignForm
-
-
class
shoop.campaigns.admin_module.form_parts.
BaseFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.admin.form_part.FormPart
-
formset
= None¶
-
template_name
= 'shoop/campaigns/admin/_edit_form.jinja'¶
-
-
class
shoop.campaigns.admin_module.form_parts.
BasketConditionsFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.BaseFormPart
-
formset
¶ alias of
BasketConditionsFormSet
-
-
class
shoop.campaigns.admin_module.form_parts.
BasketDiscountEffectsFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.BaseFormPart
-
formset
¶ alias of
BasketDiscountEffectsFormSet
-
-
class
shoop.campaigns.admin_module.form_parts.
BasketLineEffectsFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.BaseFormPart
-
formset
¶ alias of
BasketLineEffectsFormSet
-
-
class
shoop.campaigns.admin_module.form_parts.
CatalogConditionsFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.BaseFormPart
-
formset
¶ alias of
CatalogConditionsFormSet
-
-
class
shoop.campaigns.admin_module.form_parts.
CatalogFiltersFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.BaseFormPart
-
formset
¶ alias of
CatalogFiltersFormSet
-
-
class
shoop.campaigns.admin_module.form_parts.
CatalogEffectsFormPart
(request, form, name, owner)[source]¶ Bases:
shoop.campaigns.admin_module.form_parts.BaseFormPart
-
formset
¶ alias of
CatalogEffectsFormSet
-
-
class
shoop.campaigns.admin_module.form_sets.
BaseFormset
(*args, **kwargs)[source]¶ Bases:
django.forms.models.BaseModelFormSet
-
model
= None¶
-
validate_min
= False¶
-
min_num
= 0¶
-
validate_max
= False¶
-
max_num
= 20¶
-
absolute_max
= 20¶
-
can_delete
= True¶
-
can_order
= False¶
-
extra
= 0¶
-
form_class
= None¶
-
-
class
shoop.campaigns.admin_module.form_sets.
BasketConditionsFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.form_sets.BaseFormset
-
model
¶ alias of
BasketCondition
-
-
class
shoop.campaigns.admin_module.form_sets.
BasketDiscountEffectsFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.form_sets.EffectsFormset
-
model
¶ alias of
BasketDiscountEffect
-
-
class
shoop.campaigns.admin_module.form_sets.
BasketLineEffectsFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.form_sets.EffectsFormset
-
model
¶ alias of
BasketLineEffect
-
-
class
shoop.campaigns.admin_module.form_sets.
CatalogConditionsFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.form_sets.BaseFormset
-
model
¶ alias of
ContextCondition
-
-
class
shoop.campaigns.admin_module.form_sets.
CatalogFiltersFormSet
(*args, **kwargs)[source]¶ Bases:
shoop.campaigns.admin_module.form_sets.BaseFormset
-
model
¶ alias of
CatalogFilter
-
-
class
shoop.campaigns.models.basket_conditions.
BasketCondition
(id, polymorphic_ctype, active)[source]¶ Bases:
polymorphic.models.PolymorphicModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
= None¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
exception
DoesNotExist
¶
-
exception
BasketCondition.
MultipleObjectsReturned
¶
-
BasketCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketCondition.
basketmaxtotalamountcondition
¶
-
BasketCondition.
basketmaxtotalproductamountcondition
¶
-
BasketCondition.
baskettotalamountcondition
¶
-
BasketCondition.
baskettotalproductamountcondition
¶
-
BasketCondition.
campaign
¶
-
BasketCondition.
contactbasketcondition
¶
-
BasketCondition.
contactgroupbasketcondition
¶
-
BasketCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketCondition.
polymorphic_ctype
¶
-
BasketCondition.
polymorphic_primary_key_name
= 'id'¶
-
BasketCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
BasketCondition.
productsinbasketcondition
¶
-
-
class
shoop.campaigns.models.basket_conditions.
BasketTotalProductAmountCondition
(id, polymorphic_ctype, active, basketcondition_ptr, product_count)[source]¶ Bases:
shoop.campaigns.models.basket_conditions.BasketCondition
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'basket_product_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
description
¶
-
value
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_conditions.DoesNotExist
-
exception
BasketTotalProductAmountCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_conditions.MultipleObjectsReturned
-
BasketTotalProductAmountCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketTotalProductAmountCondition.
basketcondition_ptr
¶
-
BasketTotalProductAmountCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketTotalProductAmountCondition.
polymorphic_primary_key_name
= 'id'¶
-
BasketTotalProductAmountCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_conditions.
BasketTotalAmountCondition
(id, polymorphic_ctype, active, basketcondition_ptr, amount_value)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.campaigns.models.basket_conditions.BasketCondition
-
identifier
= 'basket_amount_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
amount
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
description
¶
-
value
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_conditions.DoesNotExist
-
exception
BasketTotalAmountCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_conditions.MultipleObjectsReturned
-
BasketTotalAmountCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketTotalAmountCondition.
basketcondition_ptr
¶
-
BasketTotalAmountCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketTotalAmountCondition.
polymorphic_primary_key_name
= 'id'¶
-
BasketTotalAmountCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_conditions.
BasketMaxTotalProductAmountCondition
(id, polymorphic_ctype, active, basketcondition_ptr, product_count)[source]¶ Bases:
shoop.campaigns.models.basket_conditions.BasketCondition
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'basket_max_product_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
description
¶
-
value
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_conditions.DoesNotExist
-
exception
BasketMaxTotalProductAmountCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_conditions.MultipleObjectsReturned
-
BasketMaxTotalProductAmountCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketMaxTotalProductAmountCondition.
basketcondition_ptr
¶
-
BasketMaxTotalProductAmountCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketMaxTotalProductAmountCondition.
polymorphic_primary_key_name
= 'id'¶
-
BasketMaxTotalProductAmountCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_conditions.
BasketMaxTotalAmountCondition
(id, polymorphic_ctype, active, basketcondition_ptr, amount_value)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.campaigns.models.basket_conditions.BasketCondition
-
identifier
= 'basket_max_amount_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
amount
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
description
¶
-
value
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_conditions.DoesNotExist
-
exception
BasketMaxTotalAmountCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_conditions.MultipleObjectsReturned
-
BasketMaxTotalAmountCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketMaxTotalAmountCondition.
basketcondition_ptr
¶
-
BasketMaxTotalAmountCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketMaxTotalAmountCondition.
polymorphic_primary_key_name
= 'id'¶
-
BasketMaxTotalAmountCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_conditions.
ProductsInBasketCondition
(id, polymorphic_ctype, active, basketcondition_ptr, quantity)[source]¶ Bases:
shoop.campaigns.models.basket_conditions.BasketCondition
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'basket_products_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
model
¶ alias of
Product
-
products
¶
-
description
¶
-
values
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_conditions.DoesNotExist
-
exception
ProductsInBasketCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_conditions.MultipleObjectsReturned
-
ProductsInBasketCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
ProductsInBasketCondition.
basketcondition_ptr
¶
-
ProductsInBasketCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ProductsInBasketCondition.
polymorphic_primary_key_name
= 'id'¶
-
ProductsInBasketCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_conditions.
ContactGroupBasketCondition
(id, polymorphic_ctype, active, basketcondition_ptr)[source]¶ Bases:
shoop.campaigns.models.basket_conditions.BasketCondition
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
¶ alias of
ContactGroup
-
identifier
= 'basket_contact_group_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
contact_groups
¶
-
description
¶
-
values
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_conditions.DoesNotExist
-
exception
ContactGroupBasketCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_conditions.MultipleObjectsReturned
-
ContactGroupBasketCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
ContactGroupBasketCondition.
basketcondition_ptr
¶
-
ContactGroupBasketCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ContactGroupBasketCondition.
polymorphic_primary_key_name
= 'id'¶
-
ContactGroupBasketCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_conditions.
ContactBasketCondition
(id, polymorphic_ctype, active, basketcondition_ptr)[source]¶ Bases:
shoop.campaigns.models.basket_conditions.BasketCondition
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
¶ alias of
Contact
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_conditions.DoesNotExist
-
exception
ContactBasketCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_conditions.MultipleObjectsReturned
-
ContactBasketCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
ContactBasketCondition.
basketcondition_ptr
¶
-
ContactBasketCondition.
identifier
= 'basket_contact_condition'¶
-
ContactBasketCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ContactBasketCondition.
polymorphic_primary_key_name
= 'id'¶
-
ContactBasketCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
ContactBasketCondition.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
ContactBasketCondition.
contacts
¶
-
ContactBasketCondition.
description
¶
-
ContactBasketCondition.
values
¶
-
-
class
shoop.campaigns.models.basket_effects.
BasketDiscountEffect
(id, polymorphic_ctype, campaign)[source]¶ Bases:
shoop.core.models.PolymorphicShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= None¶
-
model
= None¶
-
admin_form_class
= None¶
-
campaign
¶
-
apply_for_basket
(order_source)[source]¶ Applies the effect based on given
order_source
Returns: amount of discount to accumulate for the product Return type: Price
-
exception
DoesNotExist
¶
-
exception
BasketDiscountEffect.
MultipleObjectsReturned
¶
-
BasketDiscountEffect.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketDiscountEffect.
basketdiscountamount
¶
-
BasketDiscountEffect.
basketdiscountpercentage
¶
-
BasketDiscountEffect.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketDiscountEffect.
polymorphic_ctype
¶
-
BasketDiscountEffect.
polymorphic_primary_key_name
= 'id'¶
-
BasketDiscountEffect.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_effects.
BasketDiscountAmount
(id, polymorphic_ctype, campaign, basketdiscounteffect_ptr, discount_amount)[source]¶ Bases:
shoop.campaigns.models.basket_effects.BasketDiscountEffect
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'discount_amount_effect'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
description
¶
-
value
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_effects.DoesNotExist
-
exception
BasketDiscountAmount.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_effects.MultipleObjectsReturned
-
BasketDiscountAmount.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketDiscountAmount.
basketdiscounteffect_ptr
¶
-
BasketDiscountAmount.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketDiscountAmount.
polymorphic_primary_key_name
= 'id'¶
-
BasketDiscountAmount.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_effects.
BasketDiscountPercentage
(id, polymorphic_ctype, campaign, basketdiscounteffect_ptr, discount_percentage)[source]¶ Bases:
shoop.campaigns.models.basket_effects.BasketDiscountEffect
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'discount_percentage_effect'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
admin_form_class
¶ alias of
PercentageField
-
description
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_effects.DoesNotExist
-
exception
BasketDiscountPercentage.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_effects.MultipleObjectsReturned
-
BasketDiscountPercentage.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketDiscountPercentage.
basketdiscounteffect_ptr
¶
-
BasketDiscountPercentage.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketDiscountPercentage.
polymorphic_primary_key_name
= 'id'¶
-
BasketDiscountPercentage.
polymorphic_super_sub_accessors_replaced
= False¶
-
BasketDiscountPercentage.
value
¶
-
-
class
shoop.campaigns.models.basket_line_effects.
BasketLineEffect
(id, polymorphic_ctype, campaign)[source]¶ Bases:
shoop.core.models.PolymorphicShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= None¶
-
model
= None¶
-
admin_form_class
= None¶
-
campaign
¶
-
get_discount_lines
(order_source, original_lines)[source]¶ Applies the effect based on given
order_source
Returns: amount of discount to accumulate for the product Return type: Iterable[shoop.core.order_creator.SourceLine]
-
exception
DoesNotExist
¶
-
exception
BasketLineEffect.
MultipleObjectsReturned
¶
-
BasketLineEffect.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketLineEffect.
discountfromproduct
¶
-
BasketLineEffect.
freeproductline
¶
-
BasketLineEffect.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketLineEffect.
polymorphic_ctype
¶
-
BasketLineEffect.
polymorphic_primary_key_name
= 'id'¶
-
BasketLineEffect.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_line_effects.
FreeProductLine
(id, polymorphic_ctype, campaign, basketlineeffect_ptr, quantity)[source]¶ Bases:
shoop.campaigns.models.basket_line_effects.BasketLineEffect
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'free_product_line_effect'¶
-
model
¶ alias of
Product
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
products
¶
-
description
¶
-
values
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_line_effects.DoesNotExist
-
exception
FreeProductLine.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_line_effects.MultipleObjectsReturned
-
FreeProductLine.
base_objects
= <django.db.models.manager.Manager object>¶
-
FreeProductLine.
basketlineeffect_ptr
¶
-
FreeProductLine.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
FreeProductLine.
polymorphic_primary_key_name
= 'id'¶
-
FreeProductLine.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.basket_line_effects.
DiscountFromProduct
(id, polymorphic_ctype, campaign, basketlineeffect_ptr, per_line_discount, discount_amount)[source]¶ Bases:
shoop.campaigns.models.basket_line_effects.BasketLineEffect
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'discount_from_product_line_effect'¶
-
model
¶ alias of
Product
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
products
¶
-
description
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.basket_line_effects.DoesNotExist
-
exception
DiscountFromProduct.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.basket_line_effects.MultipleObjectsReturned
-
DiscountFromProduct.
base_objects
= <django.db.models.manager.Manager object>¶
-
DiscountFromProduct.
basketlineeffect_ptr
¶
-
DiscountFromProduct.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
DiscountFromProduct.
polymorphic_primary_key_name
= 'id'¶
-
DiscountFromProduct.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.campaigns.
CampaignType
[source]¶ Bases:
enumfields.enums.Enum
An enumeration.
-
CATALOG
= <CampaignType.CATALOG: 1>¶
-
BASKET
= <CampaignType.BASKET: 2>¶
-
-
class
shoop.campaigns.models.campaigns.
Campaign
(*args, **kwargs)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,parler.models.TranslatableModel
-
admin_url_suffix
= None¶
-
shop
¶
-
created_by
¶
-
modified_by
¶
-
class
Meta
[source]¶ Bases:
object
-
abstract
= False¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
verbose_name_plural
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
Campaign.
type
¶
-
Campaign.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Campaign.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
Campaign.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Campaign.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
Campaign.
objects
¶
-
-
class
shoop.campaigns.models.campaigns.
CatalogCampaign
(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on)[source]¶ Bases:
shoop.campaigns.models.campaigns.Campaign
-
admin_url_suffix
= 'catalog_campaigns'¶
-
conditions
¶
-
filters
¶
-
translations
¶
-
exception
DoesNotExist
¶
-
exception
CatalogCampaign.
MultipleObjectsReturned
¶
-
CatalogCampaign.
created_by
¶
-
CatalogCampaign.
effects
¶
-
CatalogCampaign.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
modified_by
¶
-
CatalogCampaign.
objects
= <parler.managers.TranslatableManager object>¶
-
CatalogCampaign.
public_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
CatalogCampaign.
shop
¶
-
-
class
shoop.campaigns.models.campaigns.
BasketCampaign
(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on, basket_line_text, coupon)[source]¶ Bases:
shoop.campaigns.models.campaigns.Campaign
-
admin_url_suffix
= 'basket_campaigns'¶
-
conditions
¶
-
coupon
¶
-
translations
¶
-
rules_match
(basket, lines)[source]¶ Check if basket rules match.
They will not match if 1) The campaign is not active 2) The campaign has attached coupon
which doesn’t match or is not active- Any of the attached rules doesn’t match
-
exception
DoesNotExist
¶
-
exception
BasketCampaign.
MultipleObjectsReturned
¶
-
BasketCampaign.
created_by
¶
-
BasketCampaign.
discount_effects
¶
-
BasketCampaign.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
line_effects
¶
-
BasketCampaign.
modified_by
¶
-
BasketCampaign.
objects
= <parler.managers.TranslatableManager object>¶
-
BasketCampaign.
public_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
BasketCampaign.
shop
¶
-
-
class
shoop.campaigns.models.campaigns.
CouponUsage
(id, coupon, order, created_by, modified_by, created_on, modified_on)[source]¶ Bases:
django.db.models.base.Model
-
coupon
¶
-
order
¶
-
created_by
¶
-
modified_by
¶
-
exception
DoesNotExist
¶
-
exception
CouponUsage.
MultipleObjectsReturned
¶
-
CouponUsage.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
CouponUsage.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
CouponUsage.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
CouponUsage.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
CouponUsage.
objects
= <django.db.models.manager.Manager object>¶
-
-
class
shoop.campaigns.models.campaigns.
Coupon
(id, code, usage_limit_customer, usage_limit, active, created_by, modified_by, created_on, modified_on)[source]¶ Bases:
django.db.models.base.Model
-
admin_url_suffix
= 'coupons'¶
-
created_by
¶
-
modified_by
¶
-
exhausted
¶
-
attached
¶
-
can_use_code
(customer)[source]¶ Check if customer can use the code
Parameters: customer ( Contact
or None) –Return type: True|False
-
exception
DoesNotExist
¶
-
exception
Coupon.
MultipleObjectsReturned
¶
-
Coupon.
campaign
¶
-
Coupon.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Coupon.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
Coupon.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Coupon.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
Coupon.
objects
= <django.db.models.manager.Manager object>¶
-
Coupon.
usages
¶
-
-
class
shoop.campaigns.models.campaigns.
BasketCampaignTranslation
(id, language_code, public_name, master)¶ Bases:
parler.models.TranslatedFieldsModel
-
exception
DoesNotExist
¶ Bases:
parler.models.TranslationDoesNotExist
,shoop.campaigns.models.campaigns.DoesNotExist
,shoop.campaigns.models.campaigns.DoesNotExist
-
exception
BasketCampaignTranslation.
MultipleObjectsReturned
¶
-
BasketCampaignTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
BasketCampaignTranslation.
master
¶
-
BasketCampaignTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.campaigns.models.campaigns.
CatalogCampaignTranslation
(id, language_code, public_name, master)¶ Bases:
parler.models.TranslatedFieldsModel
-
exception
DoesNotExist
¶ Bases:
parler.models.TranslationDoesNotExist
,shoop.campaigns.models.campaigns.DoesNotExist
,shoop.campaigns.models.campaigns.DoesNotExist
-
exception
CatalogCampaignTranslation.
MultipleObjectsReturned
¶
-
CatalogCampaignTranslation.
get_language_code_display
(*moreargs, **morekwargs)¶
-
CatalogCampaignTranslation.
master
¶
-
CatalogCampaignTranslation.
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
shoop.campaigns.models.catalog_filters.
CatalogFilter
(id, polymorphic_ctype, active)[source]¶ Bases:
polymorphic.models.PolymorphicModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
= None¶
-
identifier
= 'base_catalog_filter'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
exception
DoesNotExist
¶
-
exception
CatalogFilter.
MultipleObjectsReturned
¶
-
CatalogFilter.
base_objects
= <django.db.models.manager.Manager object>¶
-
CatalogFilter.
campaign
¶
-
CatalogFilter.
categoryfilter
¶
-
CatalogFilter.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
CatalogFilter.
polymorphic_ctype
¶
-
CatalogFilter.
polymorphic_primary_key_name
= 'id'¶
-
CatalogFilter.
polymorphic_super_sub_accessors_replaced
= False¶
-
CatalogFilter.
productfilter
¶
-
CatalogFilter.
producttypefilter
¶
-
-
class
shoop.campaigns.models.catalog_filters.
ProductTypeFilter
(id, polymorphic_ctype, active, catalogfilter_ptr)[source]¶ Bases:
shoop.campaigns.models.catalog_filters.CatalogFilter
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
¶ alias of
ProductType
-
identifier
= 'product_type_filter'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
product_types
¶
-
description
¶
-
values
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.catalog_filters.DoesNotExist
-
exception
ProductTypeFilter.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.catalog_filters.MultipleObjectsReturned
-
ProductTypeFilter.
base_objects
= <django.db.models.manager.Manager object>¶
-
ProductTypeFilter.
catalogfilter_ptr
¶
-
ProductTypeFilter.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ProductTypeFilter.
polymorphic_primary_key_name
= 'id'¶
-
ProductTypeFilter.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.catalog_filters.
ProductFilter
(id, polymorphic_ctype, active, catalogfilter_ptr)[source]¶ Bases:
shoop.campaigns.models.catalog_filters.CatalogFilter
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
¶ alias of
Product
-
identifier
= 'product_filter'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
products
¶
-
description
¶
-
values
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.catalog_filters.DoesNotExist
-
exception
ProductFilter.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.catalog_filters.MultipleObjectsReturned
-
ProductFilter.
base_objects
= <django.db.models.manager.Manager object>¶
-
ProductFilter.
catalogfilter_ptr
¶
-
ProductFilter.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ProductFilter.
polymorphic_primary_key_name
= 'id'¶
-
ProductFilter.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.catalog_filters.
CategoryFilter
(id, polymorphic_ctype, active, catalogfilter_ptr)[source]¶ Bases:
shoop.campaigns.models.catalog_filters.CatalogFilter
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
¶ alias of
Category
-
identifier
= 'category_filter'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
categories
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.catalog_filters.DoesNotExist
-
exception
CategoryFilter.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.catalog_filters.MultipleObjectsReturned
-
CategoryFilter.
base_objects
= <django.db.models.manager.Manager object>¶
-
CategoryFilter.
catalogfilter_ptr
¶
-
CategoryFilter.
description
¶
-
CategoryFilter.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
CategoryFilter.
polymorphic_primary_key_name
= 'id'¶
-
CategoryFilter.
polymorphic_super_sub_accessors_replaced
= False¶
-
CategoryFilter.
values
¶
-
-
class
shoop.campaigns.models.contact_group_sales_ranges.
SalesRangeQuerySet
(model=None, query=None, using=None, hints=None)[source]¶
-
class
shoop.campaigns.models.contact_group_sales_ranges.
ContactGroupSalesRange
(id, group, shop, min_value, max_value)[source]¶ Bases:
django.db.models.base.Model
-
group
¶
-
shop
¶
-
objects
= <django.db.models.manager.ManagerFromSalesRangeQuerySet object>¶
-
exception
DoesNotExist
¶
-
exception
ContactGroupSalesRange.
MultipleObjectsReturned
¶
-
-
class
shoop.campaigns.models.context_conditions.
ContextCondition
(id, polymorphic_ctype, active)[source]¶ Bases:
polymorphic.models.PolymorphicModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
= None¶
-
identifier
= 'context_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
exception
DoesNotExist
¶
-
exception
ContextCondition.
MultipleObjectsReturned
¶
-
ContextCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
ContextCondition.
campaign
¶
-
ContextCondition.
contactcondition
¶
-
ContextCondition.
contactgroupcondition
¶
-
ContextCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ContextCondition.
polymorphic_ctype
¶
-
ContextCondition.
polymorphic_primary_key_name
= 'id'¶
-
ContextCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.context_conditions.
ContactGroupCondition
(id, polymorphic_ctype, active, contextcondition_ptr)[source]¶ Bases:
shoop.campaigns.models.context_conditions.ContextCondition
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
¶ alias of
ContactGroup
-
identifier
= 'contact_group_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
contact_groups
¶
-
description
¶
-
values
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.context_conditions.DoesNotExist
-
exception
ContactGroupCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.context_conditions.MultipleObjectsReturned
-
ContactGroupCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
ContactGroupCondition.
contextcondition_ptr
¶
-
ContactGroupCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ContactGroupCondition.
polymorphic_primary_key_name
= 'id'¶
-
ContactGroupCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.campaigns.models.context_conditions.
ContactCondition
(id, polymorphic_ctype, active, contextcondition_ptr)[source]¶ Bases:
shoop.campaigns.models.context_conditions.ContextCondition
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
model
¶ alias of
Contact
-
identifier
= 'contact_condition'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
contacts
¶
-
description
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.context_conditions.DoesNotExist
-
exception
ContactCondition.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.context_conditions.MultipleObjectsReturned
-
ContactCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
ContactCondition.
contextcondition_ptr
¶
-
ContactCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ContactCondition.
polymorphic_primary_key_name
= 'id'¶
-
ContactCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
ContactCondition.
values
¶
-
-
class
shoop.campaigns.models.product_effects.
ProductDiscountEffect
(id, polymorphic_ctype, campaign)[source]¶ Bases:
shoop.core.models.PolymorphicShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= None¶
-
model
= None¶
-
admin_form_class
= None¶
-
campaign
¶
-
apply_for_product
(context, product, price_info)[source]¶ Applies the effect for product
Returns: amount of discount to accumulate for the product Return type: Price
-
exception
DoesNotExist
¶
-
exception
ProductDiscountEffect.
MultipleObjectsReturned
¶
-
ProductDiscountEffect.
base_objects
= <django.db.models.manager.Manager object>¶
-
ProductDiscountEffect.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ProductDiscountEffect.
polymorphic_ctype
¶
-
ProductDiscountEffect.
polymorphic_primary_key_name
= 'id'¶
-
ProductDiscountEffect.
polymorphic_super_sub_accessors_replaced
= False¶
-
ProductDiscountEffect.
productdiscountamount
¶
-
ProductDiscountEffect.
productdiscountpercentage
¶
-
-
class
shoop.campaigns.models.product_effects.
ProductDiscountAmount
(id, polymorphic_ctype, campaign, productdiscounteffect_ptr, discount_amount)[source]¶ Bases:
shoop.campaigns.models.product_effects.ProductDiscountEffect
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'discount_amount_effect'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
description
¶
-
value
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.product_effects.DoesNotExist
-
exception
ProductDiscountAmount.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.product_effects.MultipleObjectsReturned
-
ProductDiscountAmount.
base_objects
= <django.db.models.manager.Manager object>¶
-
ProductDiscountAmount.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ProductDiscountAmount.
polymorphic_primary_key_name
= 'id'¶
-
ProductDiscountAmount.
polymorphic_super_sub_accessors_replaced
= False¶
-
ProductDiscountAmount.
productdiscounteffect_ptr
¶
-
-
class
shoop.campaigns.models.product_effects.
ProductDiscountPercentage
(id, polymorphic_ctype, campaign, productdiscounteffect_ptr, discount_percentage)[source]¶ Bases:
shoop.campaigns.models.product_effects.ProductDiscountEffect
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
identifier
= 'discount_percentage_effect'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
admin_form_class
¶ alias of
PercentageField
-
description
¶
-
exception
DoesNotExist
¶ Bases:
shoop.campaigns.models.product_effects.DoesNotExist
-
exception
ProductDiscountPercentage.
MultipleObjectsReturned
¶ Bases:
shoop.campaigns.models.product_effects.MultipleObjectsReturned
-
ProductDiscountPercentage.
base_objects
= <django.db.models.manager.Manager object>¶
-
ProductDiscountPercentage.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ProductDiscountPercentage.
polymorphic_primary_key_name
= 'id'¶
-
ProductDiscountPercentage.
polymorphic_super_sub_accessors_replaced
= False¶
-
ProductDiscountPercentage.
productdiscounteffect_ptr
¶
-
ProductDiscountPercentage.
value
¶
-
-
class
shoop.campaigns.models.
BasketLineEffect
(id, polymorphic_ctype, campaign)[source]¶ Bases:
shoop.core.models.PolymorphicShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶
-
exception
BasketLineEffect.
MultipleObjectsReturned
¶
-
BasketLineEffect.
admin_form_class
= None¶
-
BasketLineEffect.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketLineEffect.
campaign
¶
-
BasketLineEffect.
discountfromproduct
¶
-
BasketLineEffect.
freeproductline
¶
-
BasketLineEffect.
get_discount_lines
(order_source, original_lines)[source]¶ Applies the effect based on given
order_source
Returns: amount of discount to accumulate for the product Return type: Iterable[shoop.core.order_creator.SourceLine]
-
BasketLineEffect.
identifier
= None¶
-
BasketLineEffect.
model
= None¶
-
BasketLineEffect.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketLineEffect.
polymorphic_ctype
¶
-
BasketLineEffect.
polymorphic_primary_key_name
= 'id'¶
-
BasketLineEffect.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.campaigns.models.
BasketCampaign
(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on, basket_line_text, coupon)[source]¶ Bases:
shoop.campaigns.models.campaigns.Campaign
-
exception
DoesNotExist
¶
-
exception
BasketCampaign.
MultipleObjectsReturned
¶
-
BasketCampaign.
admin_url_suffix
= 'basket_campaigns'¶
-
BasketCampaign.
conditions
¶
-
BasketCampaign.
coupon
¶
-
BasketCampaign.
created_by
¶
-
BasketCampaign.
discount_effects
¶
-
BasketCampaign.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
BasketCampaign.
line_effects
¶
-
BasketCampaign.
modified_by
¶
-
BasketCampaign.
objects
= <parler.managers.TranslatableManager object>¶
-
BasketCampaign.
public_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
BasketCampaign.
rules_match
(basket, lines)[source]¶ Check if basket rules match.
They will not match if 1) The campaign is not active 2) The campaign has attached coupon
which doesn’t match or is not active- Any of the attached rules doesn’t match
-
BasketCampaign.
shop
¶
-
BasketCampaign.
translations
¶
-
exception
-
class
shoop.campaigns.models.
BasketDiscountEffect
(id, polymorphic_ctype, campaign)[source]¶ Bases:
shoop.core.models.PolymorphicShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶
-
exception
BasketDiscountEffect.
MultipleObjectsReturned
¶
-
BasketDiscountEffect.
admin_form_class
= None¶
-
BasketDiscountEffect.
apply_for_basket
(order_source)[source]¶ Applies the effect based on given
order_source
Returns: amount of discount to accumulate for the product Return type: Price
-
BasketDiscountEffect.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketDiscountEffect.
basketdiscountamount
¶
-
BasketDiscountEffect.
basketdiscountpercentage
¶
-
BasketDiscountEffect.
campaign
¶
-
BasketDiscountEffect.
identifier
= None¶
-
BasketDiscountEffect.
model
= None¶
-
BasketDiscountEffect.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketDiscountEffect.
polymorphic_ctype
¶
-
BasketDiscountEffect.
polymorphic_primary_key_name
= 'id'¶
-
BasketDiscountEffect.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.campaigns.models.
BasketCondition
(id, polymorphic_ctype, active)[source]¶ Bases:
polymorphic.models.PolymorphicModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶
-
exception
BasketCondition.
MultipleObjectsReturned
¶
-
BasketCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
BasketCondition.
basketmaxtotalamountcondition
¶
-
BasketCondition.
basketmaxtotalproductamountcondition
¶
-
BasketCondition.
baskettotalamountcondition
¶
-
BasketCondition.
baskettotalproductamountcondition
¶
-
BasketCondition.
campaign
¶
-
BasketCondition.
contactbasketcondition
¶
-
BasketCondition.
contactgroupbasketcondition
¶
-
BasketCondition.
model
= None¶
-
BasketCondition.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
BasketCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
BasketCondition.
polymorphic_ctype
¶
-
BasketCondition.
polymorphic_primary_key_name
= 'id'¶
-
BasketCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
BasketCondition.
productsinbasketcondition
¶
-
exception
-
class
shoop.campaigns.models.
Campaign
(*args, **kwargs)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,parler.models.TranslatableModel
-
class
Meta
[source]¶ Bases:
object
-
abstract
= False¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
verbose_name_plural
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
Campaign.
admin_url_suffix
= None¶
-
Campaign.
created_by
¶
-
Campaign.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Campaign.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
Campaign.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Campaign.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
Campaign.
modified_by
¶
-
Campaign.
objects
¶
-
Campaign.
shop
¶
-
Campaign.
type
¶
-
class
-
class
shoop.campaigns.models.
ProductDiscountEffect
(id, polymorphic_ctype, campaign)[source]¶ Bases:
shoop.core.models.PolymorphicShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶
-
exception
ProductDiscountEffect.
MultipleObjectsReturned
¶
-
ProductDiscountEffect.
admin_form_class
= None¶
-
ProductDiscountEffect.
apply_for_product
(context, product, price_info)[source]¶ Applies the effect for product
Returns: amount of discount to accumulate for the product Return type: Price
-
ProductDiscountEffect.
base_objects
= <django.db.models.manager.Manager object>¶
-
ProductDiscountEffect.
campaign
¶
-
ProductDiscountEffect.
identifier
= None¶
-
ProductDiscountEffect.
model
= None¶
-
ProductDiscountEffect.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ProductDiscountEffect.
polymorphic_ctype
¶
-
ProductDiscountEffect.
polymorphic_primary_key_name
= 'id'¶
-
ProductDiscountEffect.
polymorphic_super_sub_accessors_replaced
= False¶
-
ProductDiscountEffect.
productdiscountamount
¶
-
ProductDiscountEffect.
productdiscountpercentage
¶
-
exception
-
class
shoop.campaigns.models.
CatalogCampaign
(id, shop, name, identifier, active, start_datetime, end_datetime, created_by, modified_by, created_on, modified_on)[source]¶ Bases:
shoop.campaigns.models.campaigns.Campaign
-
exception
DoesNotExist
¶
-
exception
CatalogCampaign.
MultipleObjectsReturned
¶
-
CatalogCampaign.
admin_url_suffix
= 'catalog_campaigns'¶
-
CatalogCampaign.
conditions
¶
-
CatalogCampaign.
created_by
¶
-
CatalogCampaign.
effects
¶
-
CatalogCampaign.
filters
¶
-
CatalogCampaign.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
CatalogCampaign.
modified_by
¶
-
CatalogCampaign.
objects
= <parler.managers.TranslatableManager object>¶
-
CatalogCampaign.
public_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
CatalogCampaign.
shop
¶
-
CatalogCampaign.
translations
¶
-
exception
-
class
shoop.campaigns.models.
CatalogFilter
(id, polymorphic_ctype, active)[source]¶ Bases:
polymorphic.models.PolymorphicModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶
-
exception
CatalogFilter.
MultipleObjectsReturned
¶
-
CatalogFilter.
base_objects
= <django.db.models.manager.Manager object>¶
-
CatalogFilter.
campaign
¶
-
CatalogFilter.
categoryfilter
¶
-
CatalogFilter.
identifier
= 'base_catalog_filter'¶
-
CatalogFilter.
model
= None¶
-
CatalogFilter.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
CatalogFilter.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
CatalogFilter.
polymorphic_ctype
¶
-
CatalogFilter.
polymorphic_primary_key_name
= 'id'¶
-
CatalogFilter.
polymorphic_super_sub_accessors_replaced
= False¶
-
CatalogFilter.
productfilter
¶
-
CatalogFilter.
producttypefilter
¶
-
exception
-
class
shoop.campaigns.models.
ContactGroupSalesRange
(id, group, shop, min_value, max_value)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
ContactGroupSalesRange.
MultipleObjectsReturned
¶
-
ContactGroupSalesRange.
group
¶
-
ContactGroupSalesRange.
objects
= <django.db.models.manager.ManagerFromSalesRangeQuerySet object>¶
-
ContactGroupSalesRange.
shop
¶
-
exception
-
class
shoop.campaigns.models.
ContextCondition
(id, polymorphic_ctype, active)[source]¶ Bases:
polymorphic.models.PolymorphicModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶
-
exception
ContextCondition.
MultipleObjectsReturned
¶
-
ContextCondition.
base_objects
= <django.db.models.manager.Manager object>¶
-
ContextCondition.
campaign
¶
-
ContextCondition.
contactcondition
¶
-
ContextCondition.
contactgroupcondition
¶
-
ContextCondition.
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
ContextCondition.
identifier
= 'context_condition'¶
-
ContextCondition.
model
= None¶
-
ContextCondition.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
ContextCondition.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ContextCondition.
polymorphic_ctype
¶
-
ContextCondition.
polymorphic_primary_key_name
= 'id'¶
-
ContextCondition.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.campaigns.models.
Coupon
(id, code, usage_limit_customer, usage_limit, active, created_by, modified_by, created_on, modified_on)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Coupon.
MultipleObjectsReturned
¶
-
Coupon.
admin_url_suffix
= 'coupons'¶
-
Coupon.
attached
¶
-
Coupon.
campaign
¶
-
Coupon.
can_use_code
(customer)[source]¶ Check if customer can use the code
Parameters: customer ( Contact
or None) –Return type: True|False
-
Coupon.
created_by
¶
-
Coupon.
exhausted
¶
-
Coupon.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Coupon.
get_next_by_modified_on
(*moreargs, **morekwargs)¶
-
Coupon.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Coupon.
get_previous_by_modified_on
(*moreargs, **morekwargs)¶
-
Coupon.
modified_by
¶
-
Coupon.
objects
= <django.db.models.manager.Manager object>¶
-
Coupon.
usages
¶
-
exception
-
class
shoop.campaigns.apps.
CampaignAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.campaigns'¶
-
verbose_name
= 'Shoop Campaigns'¶
-
label
= 'campaigns'¶
-
provides
= {'campaign_catalog_filter': ['shoop.campaigns.admin_module.forms:ProductTypeFilterForm', 'shoop.campaigns.admin_module.forms:ProductFilterForm', 'shoop.campaigns.admin_module.forms:CategoryFilterForm'], 'admin_module': ['shoop.campaigns.admin_module:CampaignAdminModule'], 'campaign_basket_discount_effect_form': ['shoop.campaigns.admin_module.forms:BasketDiscountAmountForm', 'shoop.campaigns.admin_module.forms:BasketDiscountPercentageForm'], 'order_source_modifier_module': ['shoop.campaigns.modules:BasketCampaignModule'], 'admin_contact_group_form_part': ['shoop.campaigns.admin_module.form_parts:SalesRangesFormPart'], 'campaign_product_discount_effect_form': ['shoop.campaigns.admin_module.forms:ProductDiscountAmountForm', 'shoop.campaigns.admin_module.forms:ProductDiscountPercentageForm'], 'campaign_context_condition': ['shoop.campaigns.admin_module.forms:ContactGroupConditionForm', 'shoop.campaigns.admin_module.forms:ContactConditionForm'], 'campaign_basket_condition': ['shoop.campaigns.admin_module.forms:BasketTotalProductAmountConditionForm', 'shoop.campaigns.admin_module.forms:BasketTotalAmountConditionForm', 'shoop.campaigns.admin_module.forms:BasketMaxTotalProductAmountConditionForm', 'shoop.campaigns.admin_module.forms:BasketMaxTotalAmountConditionForm', 'shoop.campaigns.admin_module.forms:ProductsInBasketConditionForm', 'shoop.campaigns.admin_module.forms:ContactGroupBasketConditionForm', 'shoop.campaigns.admin_module.forms:ContactBasketConditionForm'], 'campaign_basket_line_effect_form': ['shoop.campaigns.admin_module.forms:FreeProductLineForm', 'shoop.campaigns.admin_module.forms:DiscountFromProductForm'], 'discount_module': ['shoop.campaigns.modules:CatalogCampaignModule']}¶
-
-
class
shoop.campaigns.modules.
CatalogCampaignModule
[source]¶ Bases:
shoop.core.pricing.DiscountModule
-
identifier
= 'catalog_campaigns'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.campaigns.modules.
BasketCampaignModule
[source]¶ Bases:
shoop.core.order_creator.OrderSourceModifierModule
-
identifier
= 'basket_campaigns'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.core.api.orders.
OrderLineSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
shoop.core.api.orders.
AddressSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
shoop.core.api.orders.
PaymentSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
shoop.core.api.orders.
OrderSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
shoop.core.api.products.
ShopProductSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
shoop.core.api.products.
ProductSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
parler_rest.serializers.TranslatableModelSerializer
-
class
shoop.core.api.products.
ProductViewSet
(**kwargs)[source]¶ Bases:
rest_framework.viewsets.ModelViewSet
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
queryset
= []¶
-
serializer_class
¶ alias of
ProductSerializer
-
suffix
= None¶
-
-
shoop.core.cache.impl.
get_cache_duration
(cache_key)[source]¶ Determine a cache duration for the given cache key.
Parameters: cache_key (str) – Cache key string Returns: Timeout seconds Return type: int
-
class
shoop.core.cache.impl.
VersionedCache
(using)[source]¶ Bases:
object
Parameters: using (str) – Cache alias -
bump_version
(cache_key)[source]¶ Bump up the cache version for the given cache key/namespace.
Parameters: cache_key (str) – Cache key or namespace
-
get_version
(cache_key)[source]¶ Get the cache version (or None) for the given cache key/namespace.
The cache version is stored in thread-local storage for the current request, so unless bumped in-request, all gets within a single request should get coherently versioned data from the cache.
Parameters: cache_key (str) – Cache key or namespace Returns: Version ID or none Return type: str|None
-
set
(key, value, timeout=None, version=None)[source]¶ Set the value for key
key
in the cache.Unlike
django.core.caches[using].set()
, this also derives timeout and versioning information from the key (and cached version data) if the key begins with a colon-separated namespace, such asfoo:bar
.Parameters:
-
get
(key, version=None, default=None)[source]¶ Get the value for key
key
in the cache.Unlike
django.core.caches[using].get()
, versioning information can be auto-derived from the key (and cached version data) if the key begins with a colon-separated namespace, such asfoo:bar
.Parameters: Returns: cached value
Return type:
-
Utilities for versioned caching and automatic timeout determination.
Versioning works by way of namespaces. Namespaces are the first colon-separated part of cache keys.
For instance, the cache keys price:10
, price:20
, and price
all belong to the price
namespace and can be invalidated with
one bump_version("price")
call.
The versions themselves are stored within the cache, within the
_version
namespace. (As an implementation detail, this allows one
to invalidate _all_ versioned keys by bumping the version of
_version
. Very meta!)
-
class
shoop.core.cache.
VersionedCache
(using)[source]¶ Bases:
object
Parameters: using (str) – Cache alias -
bump_version
(cache_key)[source]¶ Bump up the cache version for the given cache key/namespace.
Parameters: cache_key (str) – Cache key or namespace
-
get
(key, version=None, default=None)[source]¶ Get the value for key
key
in the cache.Unlike
django.core.caches[using].get()
, versioning information can be auto-derived from the key (and cached version data) if the key begins with a colon-separated namespace, such asfoo:bar
.Parameters: Returns: cached value
Return type:
-
get_version
(cache_key)[source]¶ Get the cache version (or None) for the given cache key/namespace.
The cache version is stored in thread-local storage for the current request, so unless bumped in-request, all gets within a single request should get coherently versioned data from the cache.
Parameters: cache_key (str) – Cache key or namespace Returns: Version ID or none Return type: str|None
-
set
(key, value, timeout=None, version=None)[source]¶ Set the value for key
key
in the cache.Unlike
django.core.caches[using].set()
, this also derives timeout and versioning information from the key (and cached version data) if the key begins with a colon-separated namespace, such asfoo:bar
.Parameters:
-
“Tagged JSON” encoder/decoder.
Objects that are normally not unambiguously representable via JSON
are encoded into special objects of the form {tag: val}
; the encoding
and decoding process can be customized however necessary.
-
shoop.core.fields.tagged_json.
tag_registry
= <shoop.core.fields.tagged_json.TagRegistry object>¶ The default tag registry.
-
class
shoop.core.fields.tagged_json.
TaggedJSONEncoder
(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ Bases:
jsonfield.encoder.JSONEncoder
Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped.
If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters.
If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place.
If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.
If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.
If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.
If specified, separators should be an (item_separator, key_separator) tuple. The default is (‘, ‘, ‘: ‘) if indent is
None
and (‘,’, ‘: ‘) otherwise. To get the most compact JSON representation, you should specify (‘,’, ‘:’) to eliminate whitespace.If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a
TypeError
.-
registry
= <shoop.core.fields.tagged_json.TagRegistry object>¶
-
-
class
shoop.core.fields.
InternalIdentifierField
(**kwargs)[source]¶ Bases:
django.db.models.fields.CharField
-
class
shoop.core.fields.
FormattedDecimalFormField
(max_value=None, min_value=None, max_digits=None, decimal_places=None, *args, **kwargs)[source]¶ Bases:
django.forms.fields.DecimalField
-
MAX_DECIMAL_PLACES_FOR_STEP
= 5¶
-
-
class
shoop.core.fields.
FormattedDecimalField
(verbose_name=None, name=None, max_digits=None, decimal_places=None, **kwargs)[source]¶ Bases:
django.db.models.fields.DecimalField
DecimalField subclass to display decimal values in non-scientific format.
-
class
shoop.core.fields.
MeasurementField
(unit, **kwargs)[source]¶ Bases:
shoop.core.fields.FormattedDecimalField
-
KNOWN_UNITS
= ('mm', 'm', 'kg', 'g', 'm3')¶
-
-
class
shoop.core.fields.
LanguageField
(*args, **kwargs)[source]¶ Bases:
django.db.models.fields.CharField
-
LANGUAGE_CODES
= {'tyv', 'sga', 'cy', 'vo', 'kru', 'bbc', 'ban', 'tsd', 'ceb', 'jbo', 'tzm', 'krj', 'sad', 'zap', 'ml', 'udm', 'he', 'fr', 'ss', 'rar', 'gor', 'fur', 'asa', 'lol', 'cu', 'pfl', 'moh', 'nia', 'jam', 'dak', 'ale', 'lam', 'kbl', 'chy', 'frm', 'umb', 'mai', 'lzz', 'ar', 'ii', 'kho', 'lv', 'fj', 'bin', 'khw', 'myv', 'bal', 'sid', 'bgn', 'bas', 'mak', 'arp', 'gaa', 'so', 'naq', 'liv', 'bfq', 'pcd', 'smn', 'rwk', 'hz', 'ssy', 'vai', 'bum', 'nb', 'es', 'tli', 'dzg', 'mh', 'sh', 'bs', 'kha', 'lo', 'izh', 'lg', 'ay', 'ur', 'efi', 'qu', 'anp', 'kos', 'mgh', 'sg', 'rue', 'ja', 'akz', 'mi', 'gmh', 'ltg', 'bem', 'nyn', 'sn', 'fro', 'gsw', 'stq', 'co', 'lua', 'brx', 'ie', 'kok', 'hai', 'lt', 'frc', 'vun', 'is', 'bax', 'zbl', 'ba', 'kab', 'sa', 'os', 'sba', 'ang', 'ro', 'mk', 'kaw', 'swc', 'ms', 'jrb', 'za', 'kut', 'lez', 'sei', 'avk', 'lun', 'bej', 'fo', 'wa', 'war', 'nym', 'arz', 'mga', 'ch', 'crh', 'kbd', 'en_US', 'te', 'ksb', 'li', 'ach', 'tet', 'kkj', 'hif', 'rap', 'suk', 'gd', 'ksh', 'zh', 'arn', 'see', 'tkr', 'ro_MD', 'es_MX', 'km', 'ne', 'ko', 'sc', 'dje', 'de_CH', 'loz', 'cs', 'sel', 'bm', 'ak', 'frp', 'br', 'jgo', 'hsn', 'kmb', 'ewo', 'ny', 'shu', 'wbp', 'or', 'chk', 'shi', 'teo', 'lrc', 'pdc', 'nqo', 'es_ES', 'eka', 'nwc', 'car', 'bla', 'xh', 'tt', 'kiu', 'hr', 'sq', 'jv', 'az', 'kam', 'gn', 'dum', 'dyu', 'dyo', 'ka', 'krc', 'hak', 'wuu', 'bqi', 'sma', 'bjn', 'av', 'pt', 'chn', 'ty', 'bi', 'gba', 'bra', 'was', 'luy', 'ta', 'peo', 'zh_Hant', 'khq', 'mn', 'tsi', 'got', 'akk', 'ik', 'guz', 'tpi', 'twq', 'mdf', 'pms', 'sgs', 'chp', 'byv', 'gl', 'ky', 'lmo', 'oj', 'ti', 'sdh', 'ilo', 'byn', 'sas', 'aa', 'vec', 'mic', 'sco', 'lag', 'be', 'trv', 'ase', 'ng', 'dv', 'cps', 'hmn', 'io', 'gu', 'mfe', 'ho', 'ksf', 'vro', 'smj', 'iu', 'kfo', 'kl', 'gez', 'la', 'vmf', 'mwv', 'hit', 'dav', 'tru', 'mg', 'nnh', 'rug', 'tiv', 'na', 'pt_PT', 'sr', 'pi', 'pt_BR', 'root', 'ter', 'sl', 'quc', 'egl', 'fon', 'da', 'pal', 'srr', 'zgh', 'hy', 'kac', 'ckb', 'fil', 'sw', 'sm', 'ru', 'ken', 'hil', 'rif', 'sly', 'zza', 'sah', 'nus', 'agq', 'wal', 'wae', 'mos', 'kk', 'pam', 'as', 'mua', 'new', 'cay', 'tk', 'syc', 'kri', 'maf', 'ace', 'arq', 'nov', 'de_AT', 'lus', 'uga', 'vi', 'bik', 'ar_001', 'yi', 'id', 'pag', 'rm', 'kg', 'mag', 'ps', 'ab', 'awa', 'lu', 'tog', 'fy', 'bss', 'mas', 'ady', 'gwi', 'mul', 'mr', 'st', 'xog', 'lad', 'cgg', 'niu', 'mye', 'srn', 'gbz', 'sbp', 'aln', 'kv', 'snk', 'hup', 'cr', 'haw', 'sd', 'kw', 'cho', 'kaa', 'kn', 'rof', 'rgn', 'qug', 'nn', 'en_CA', 'pon', 'ks', 'fi', 'sog', 'ku', 'th', 'pau', 'bar', 'mwl', 'gil', 'arc', 'nl_BE', 'min', 'doi', 'seh', 'yav', 'fat', 'ha', 'sat', 'tl', 'njo', 'kum', 'an', 'yap', 'ff', 'yo', 'nog', 'enm', 'my', 'mer', 'bpy', 'ota', 'fan', 'lui', 'pnt', 'cad', 'tly', 'mnc', 'tlh', 'bug', 'iba', 'frs', 'rup', 'zun', 'rom', 'csb', 'mwr', 'alt', 'to', 'ibb', 'cop', 'et', 'zu', 'grb', 'swb', 'chr', 'sms', 'bez', 'und', 'tmh', 'mt', 'eo', 'sv', 'zh_Hans', 'rw', 'sam', 'rn', 'es_419', 'osa', 'kr', 'mgo', 'non', 'ga', 'tn', 'mni', 'kde', 'aeb', 'guc', 'dgr', 'nzi', 'lkt', 'ht', 'bho', 'hi', 'tw', 'de', 'phn', 'bg', 'bew', 'kj', 'ext', 'ts', 'saq', 'mde', 'nyo', 'sdc', 'koi', 'ebu', 'prg', 'rtm', 'kaj', 'zen', 'yue', 'lah', 'hu', 'xmf', 'am', 'esu', 'gag', 'su', 'gay', 'si', 'zea', 'kln', 'mzn', 'el', 'nan', 'pap', 'ae', 'nds', 'ttt', 'vot', 'sli', 'fa_AF', 'chm', 'lfn', 'brh', 'ybb', 'nr', 'kea', 'szl', 'ig', 'ug', 'bfd', 'uz', 'inh', 'frr', 'gom', 'sux', 'kpe', 'krl', 'afh', 'luo', 'tig', 'pl', 'tem', 'pdt', 'yao', 'jmc', 'fit', 'shn', 'arw', 'egy', 'man', 'gv', 'ee', 'tcy', 'mus', 'syr', 'raj', 'bn', 'fr_CA', 'vep', 'mdr', 'dz', 'ary', 'grc', 'kcg', 'mad', 'goh', 'nds_NL', 'no', 'dua', 'ast', 'den', 'aro', 'oc', 'dtp', 'lij', 'hsb', 'chg', 'jut', 'nmg', 'tg', 'ain', 'chb', 'om', 'ia', 'men', 'ses', 'glk', 'en', 'cch', 'bo', 'del', 'se', 'fr_CH', 'nl', 'tvl', 'ln', 'lzh', 'fa', 'elx', 'sk', 'ki', 'yrl', 'kgp', 'lb', 'tum', 'mrj', 'zxx', 'sus', 'uk', 'nd', 'en_AU', 'wo', 'bbj', 'it', 'tkl', 'ca', 'en_GB', 've', 'jpr', 'ada', 'bua', 'vls', 'nap', 'gan', 'scn', 'dsb', 'xal', 'tr', 'af', 'cv', 'saz', 'gon', 'gur', 'nso', 'din', 'ce', 'eu', 'pa', 'nv', 'dar', 'bkm', 'pro'}¶
-
Patched version of Django’s Makemessages that works with Jinja2.
Works by monkey patching django.utils.translation.trans_real.templatize with our version.
-
class
shoop.core.management.commands.makemessages.
Command
(stdout=None, stderr=None, no_color=False)[source]¶ Bases:
django.core.management.commands.makemessages.Command
-
class
shoop.core.management.commands.shoop_init.
Initializer
[source]¶ Bases:
object
-
schemata
= [{'model': <class 'shoop.core.models.Shop'>, 'info': {'name': 'Default Shop', 'status': <ShopStatus.ENABLED: 1>}, 'identifier': 'default'}, {'model': <class 'shoop.core.models.ProductType'>, 'info': {'name': 'Standard Product'}, 'identifier': 'default'}, {'model': <class 'shoop.core.models.ProductType'>, 'info': {'name': 'Download Product'}, 'identifier': 'download'}, {'model': <class 'shoop.core.models.TaxClass'>, 'info': {'name': 'Default Tax Class'}, 'identifier': 'default'}, {'model': <class 'shoop.core.models.CustomPaymentProcessor'>, 'info': {'name': 'Manual payment processing'}, 'identifier': 'CustomPaymentProcessor'}, {'model': <class 'shoop.core.models.PaymentMethod'>, 'info': {'payment_processor': <class 'shoop.core.models.CustomPaymentProcessor'>, 'name': 'Default Payment Method', 'tax_class': <class 'shoop.core.models.TaxClass'>, 'shop': <class 'shoop.core.models.Shop'>}, 'identifier': 'default_payment_method'}, {'model': <class 'shoop.core.models.CustomCarrier'>, 'info': {'name': 'Carrier'}, 'identifier': 'CustomCarrier'}, {'model': <class 'shoop.core.models.ShippingMethod'>, 'info': {'carrier': <class 'shoop.core.models.CustomCarrier'>, 'name': 'Default Shipping Method', 'tax_class': <class 'shoop.core.models.TaxClass'>, 'shop': <class 'shoop.core.models.Shop'>}, 'identifier': 'default_shipping_method'}, {'model': <class 'shoop.core.models.Supplier'>, 'info': {'name': 'Default Supplier'}, 'identifier': 'default'}, {'model': <class 'shoop.core.models.SalesUnit'>, 'info': {'name': 'Pieces'}, 'identifier': 'pcs'}, {'model': <class 'shoop.core.models.Category'>, 'info': {'name': 'Default Category'}, 'identifier': 'default'}, {'model': <class 'shoop.core.models.CustomerTaxGroup'>, 'info': {'name': 'Retail Customers'}, 'identifier': 'default_person_customers'}, {'model': <class 'shoop.core.models.CustomerTaxGroup'>, 'info': {'name': 'Company Customers'}, 'identifier': 'default_company_customers'}]¶
-
Makemessages helper for Shoop projects.
Runs Django’s makemessages for django and djangojs domains with sane defaults for Shoop projects (ignores and extensions).
-
class
shoop.core.management.commands.shoop_makemessages.
Command
(stdout=None, stderr=None, no_color=False)[source]¶ Bases:
shoop.core.management.commands.makemessages.Command
-
help
= "\nMakemessages helper for Shoop projects.\n\nRuns Django's makemessages for django and djangojs domains with sane\ndefaults for Shoop projects (ignores and extensions).\n"¶
-
Show known Shoop settings and their values.
-
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, merchant_notes, account_manager, contact_ptr)¶ Bases:
shoop.core.models.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.
default_contact_group_identifier
= 'default_anonymous_group'¶
-
AnonymousContact.
default_contact_group_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
AnonymousContact.
groups
¶ Contact groups accessor for anonymous contact.
The base class already has a
groups
property viaContactGroup
related_name, but this overrides it forAnonymousContact
so that it will return a queryset containing just the anonymous contact group rather than returning the original related manager, which cannot work sinceAnonymousContact
is not in the database.This allows to use statements like this for all kinds of contacts, even
AnonymousContact
:some_contact.groups.all()
Return type: django.db.QuerySet
-
AnonymousContact.
id
= None¶
-
AnonymousContact.
is_anonymous
= True¶
-
AnonymousContact.
objects
= <polymorphic.managers.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)¶ 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.
AttributeType
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
BOOLEAN
= <AttributeType.BOOLEAN: 2>¶
-
DATE
= <AttributeType.DATE: 11>¶
-
DATETIME
= <AttributeType.DATETIME: 10>¶
-
DECIMAL
= <AttributeType.DECIMAL: 3>¶
-
INTEGER
= <AttributeType.INTEGER: 1>¶
-
TIMEDELTA
= <AttributeType.TIMEDELTA: 4>¶
-
TRANSLATED_STRING
= <AttributeType.TRANSLATED_STRING: 20>¶
-
UNTRANSLATED_STRING
= <AttributeType.UNTRANSLATED_STRING: 21>¶
-
-
class
shoop.core.models.
AttributeVisibility
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
HIDDEN
= <AttributeVisibility.HIDDEN: 0>¶
-
NOT_VISIBLE
= <AttributeVisibility.NOT_VISIBLE: 3>¶
-
SEARCHABLE_FIELD
= <AttributeVisibility.SEARCHABLE_FIELD: 2>¶
-
SHOW_ON_PRODUCT_PAGE
= <AttributeVisibility.SHOW_ON_PRODUCT_PAGE: 1>¶
-
-
class
shoop.core.models.
Carrier
(*args, **kwargs)¶ Bases:
shoop.core.models.ServiceProvider
Service provider interface for shipment processing.
Services provided by a carrier are
shipping methods
. To create a new shipping method for a carrier, use thecreate_service
method.Implementers of this interface will provide provide a list of shipping service choices and each related shipping method should have one of those service choices assigned to it.
Note:
Carrier
objects should never be created on their own but rather through a concrete subclass.Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
Carrier.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
Carrier.
base_objects
= <parler.managers.TranslatableManager object>¶
-
Carrier.
customcarrier
¶
-
Carrier.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
Carrier.
polymorphic_primary_key_name
= 'id'¶
-
Carrier.
polymorphic_super_sub_accessors_replaced
= False¶
-
Carrier.
service_model
¶ alias of
ShippingMethod
-
Carrier.
serviceprovider_ptr
¶
-
Carrier.
shippingmethod_set
¶
-
exception
-
class
shoop.core.models.
Category
(id, parent, identifier, status, image, ordering, visibility)¶ 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.
categoryfilter_set
¶
-
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.
CategoryStatus
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
DELETED
= <CategoryStatus.DELETED: 2>¶
-
INVISIBLE
= <CategoryStatus.INVISIBLE: 0>¶
-
VISIBLE
= <CategoryStatus.VISIBLE: 1>¶
-
-
class
shoop.core.models.
CategoryVisibility
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
VISIBLE_TO_ALL
= <CategoryVisibility.VISIBLE_TO_ALL: 1>¶
-
VISIBLE_TO_GROUPS
= <CategoryVisibility.VISIBLE_TO_GROUPS: 3>¶
-
VISIBLE_TO_LOGGED_IN
= <CategoryVisibility.VISIBLE_TO_LOGGED_IN: 2>¶
-
-
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, merchant_notes, account_manager, contact_ptr, tax_number)¶ Bases:
shoop.core.models.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.
default_contact_group_identifier
= 'default_company_group'¶
-
CompanyContact.
default_contact_group_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
CompanyContact.
default_tax_group_getter
()¶
-
CompanyContact.
members
¶
-
CompanyContact.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
CompanyContact.
polymorphic_primary_key_name
= 'id'¶
-
CompanyContact.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.core.models.
ConfigurationItem
(id, shop, key, value)¶ Bases:
shoop.core.models.ShoopModel
-
exception
DoesNotExist
¶
-
exception
ConfigurationItem.
MultipleObjectsReturned
¶
-
ConfigurationItem.
objects
= <django.db.models.manager.Manager object>¶
-
ConfigurationItem.
shop
¶
-
ConfigurationItem.
value
¶ A placeholder class that provides a way to set the attribute on the model.
-
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, merchant_notes, account_manager)¶ Bases:
shoop.core.models.PolymorphicShoopModel
-
exception
DoesNotExist
¶
-
exception
Contact.
MultipleObjectsReturned
¶
-
Contact.
account_manager
¶
-
Contact.
anonymouscontact
¶
-
Contact.
base_objects
= <django.db.models.manager.Manager object>¶
-
Contact.
company_memberships
¶
-
Contact.
companycontact
¶
-
Contact.
contactbasketcondition_set
¶
-
Contact.
contactcondition_set
¶
-
Contact.
customer_baskets
¶
-
Contact.
customer_orders
¶
-
Contact.
default_billing_address
¶
-
Contact.
default_contact_group_identifier
= None¶
-
Contact.
default_contact_group_name
= None¶
-
Contact.
default_payment_method
¶
-
Contact.
default_shipping_address
¶
-
Contact.
default_shipping_method
¶
-
Contact.
default_tax_group_getter
= None¶
-
Contact.
full_name
¶
-
classmethod
Contact.
get_default_group
()[source]¶ Get or create default contact group for the class.
Identifier of the group is specified by the class property
default_contact_group_identifier
.If new group is created, its name is set to value of
default_contact_group_name
class property.Return type: core.models.ContactGroup
-
Contact.
get_language_display
(*moreargs, **morekwargs)¶
-
Contact.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Contact.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Contact.
get_price_display_options
()[source]¶ Get price display options of the contact.
If the default group (
get_default_group
) defines price display options and the contact is member of it, return it.If contact is not (anymore) member of the default group or the default group does not define options, return one of the groups which defines options. If there is more than one such groups, it is undefined which options will be used.
If contact is not a member of any group that defines price display options, return default constructed
PriceDisplayOptions
.Subclasses may still override this default behavior.
Return type: PriceDisplayOptions
-
Contact.
get_timezone_display
(*moreargs, **morekwargs)¶
-
Contact.
groups
¶
-
Contact.
is_all_seeing
= False¶
-
Contact.
is_anonymous
= False¶
-
Contact.
objects
= <polymorphic.managers.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, show_prices_including_taxes, hide_prices)¶ Bases:
shoop.core.models.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
ContactGroup.
MultipleObjectsReturned
¶
-
ContactGroup.
cgpprice_set
¶
-
ContactGroup.
contactgroupbasketcondition_set
¶
-
ContactGroup.
contactgroupcondition_set
¶
-
ContactGroup.
groupavailabilitybehaviorcomponent_set
¶
-
ContactGroup.
members
¶
-
ContactGroup.
name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
ContactGroup.
objects
= <django.db.models.manager.ManagerFromContactGroupQuerySet object>¶
-
ContactGroup.
translations
¶
-
ContactGroup.
visible_categories
¶
-
ContactGroup.
visible_products
¶
-
exception
-
class
shoop.core.models.
GroupAvailabilityBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr)¶ Bases:
shoop.core.models.ServiceBehaviorComponent
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
GroupAvailabilityBehaviorComponent.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
GroupAvailabilityBehaviorComponent.
base_objects
= <django.db.models.manager.Manager object>¶
-
GroupAvailabilityBehaviorComponent.
groups
¶
-
GroupAvailabilityBehaviorComponent.
help_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
GroupAvailabilityBehaviorComponent.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
GroupAvailabilityBehaviorComponent.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
GroupAvailabilityBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
GroupAvailabilityBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
GroupAvailabilityBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
exception
-
class
shoop.core.models.
Counter
(id, value)¶ 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.
CounterType
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
ORDER_REFERENCE
= <CounterType.ORDER_REFERENCE: 1>¶
-
-
class
shoop.core.models.
CustomCarrier
(*args, **kwargs)¶ Bases:
shoop.core.models.Carrier
Carrier without any integration or special processing.
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_shipping.DoesNotExist
-
exception
CustomCarrier.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_shipping.MultipleObjectsReturned
-
CustomCarrier.
base_objects
= <parler.managers.TranslatableManager object>¶
-
CustomCarrier.
carrier_ptr
¶
-
CustomCarrier.
carrierwithcheckoutphase
¶
-
CustomCarrier.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
CustomCarrier.
polymorphic_primary_key_name
= 'id'¶
-
CustomCarrier.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.core.models.
CustomerTaxGroup
(id, identifier, enabled)¶ Bases:
shoop.core.models.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.
CustomPaymentProcessor
(*args, **kwargs)¶ Bases:
shoop.core.models.PaymentProcessor
Payment processor without any integration or special processing.
Can be used for payment methods whose payments are processed manually.
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_payment.DoesNotExist
-
exception
CustomPaymentProcessor.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_payment.MultipleObjectsReturned
-
CustomPaymentProcessor.
base_objects
= <parler.managers.TranslatableManager object>¶
-
CustomPaymentProcessor.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
CustomPaymentProcessor.
paymentprocessor_ptr
¶
-
CustomPaymentProcessor.
paymentwithcheckoutphase
¶
-
CustomPaymentProcessor.
polymorphic_primary_key_name
= 'id'¶
-
CustomPaymentProcessor.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.core.models.
FixedCostBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr, price_value)¶ Bases:
shoop.core.models._service_base.TranslatableServiceBehaviorComponent
-
exception
DoesNotExist
¶
-
exception
FixedCostBehaviorComponent.
MultipleObjectsReturned
¶
-
FixedCostBehaviorComponent.
base_objects
= <parler.managers.TranslatableManager object>¶
-
FixedCostBehaviorComponent.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
FixedCostBehaviorComponent.
help_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
FixedCostBehaviorComponent.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
FixedCostBehaviorComponent.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
FixedCostBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
FixedCostBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
FixedCostBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
FixedCostBehaviorComponent.
translations
¶
-
exception
-
shoop.core.models.
get_company_contact
(user)¶ Get preferred CompanyContact of given user.
If user has associated PersonContact which is member of CompanyContact, return CompanyContact. Otherwise, return None.
Parameters: user (django.contrib.auth.models.User|None) – User object (or None) to get contact for Returns: CompanyContact (or none) of which user’s PersonContact is a member Return type: CompanyContact|None
-
shoop.core.models.
get_person_contact
(user)¶ 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 Return type: PersonContact|AnonymousContact
-
class
shoop.core.models.
Gender
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
FEMALE
= <Gender.FEMALE: 'f'>¶
-
MALE
= <Gender.MALE: 'm'>¶
-
OTHER
= <Gender.OTHER: 'o'>¶
-
UNDISCLOSED
= <Gender.UNDISCLOSED: 'u'>¶
-
-
class
shoop.core.models.
ImmutableAddress
(*args, **kwargs)¶ Bases:
shoop.core.models._base.ChangeProtected
,shoop.core.models._addresses.Address
An address that can not be changed.
Immutable addresses are used for orders, etc., where subsequent edits to the original address (for example an user’s default address) must not affect past business data.
Immutable addresses can be created directly, with the
from_data()
method, or by creating an immutable copy of an existingMutableAddress
with theAddress.to_immutable()
method.-
exception
DoesNotExist
¶
-
exception
ImmutableAddress.
MultipleObjectsReturned
¶
-
ImmutableAddress.
billing_orders
¶
-
ImmutableAddress.
country
¶ A descriptor for country fields on a model instance. Returns a Country when accessed so you can do things like:
>>> from people import Person >>> person = Person.object.get(name='Chris') >>> person.country.name 'New Zealand' >>> person.country.flag '/static/flags/nz.gif'
-
classmethod
ImmutableAddress.
from_data
(data)[source]¶ Get or create immutable address with given data.
Parameters: data (dict[str,str]) – data for address Returns: Saved immutable address Return type: ImmutableAddress
-
ImmutableAddress.
get_country_display
(*moreargs, **morekwargs)¶
-
ImmutableAddress.
objects
= <django.db.models.manager.Manager object>¶
-
ImmutableAddress.
shipping_orders
¶
-
exception
-
class
shoop.core.models.
Manufacturer
(id, created_on, identifier, name, url)¶ 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.
MutableAddress
(*args, **kwargs)¶ Bases:
shoop.core.models._addresses.Address
An address that can be changed.
Mutable addresses are used for e.g. contact’s saved addresses. They are saved as new immutable addresses when used in e.g. orders.
Mutable addresses can be created with
MutableAddress.from_data
or with theto_mutable
method ofAddress
objects.-
exception
DoesNotExist
¶
-
exception
MutableAddress.
MultipleObjectsReturned
¶
-
MutableAddress.
country
¶ A descriptor for country fields on a model instance. Returns a Country when accessed so you can do things like:
>>> from people import Person >>> person = Person.object.get(name='Chris') >>> person.country.name 'New Zealand' >>> person.country.flag '/static/flags/nz.gif'
-
classmethod
MutableAddress.
from_data
(data)[source]¶ Construct mutable address from a data dictionary.
Parameters: data (dict[str,str]) – data for address Returns: Unsaved mutable address Return type: MutableAddress
-
MutableAddress.
get_country_display
(*moreargs, **morekwargs)¶
-
MutableAddress.
objects
= <django.db.models.manager.Manager object>¶
-
MutableAddress.
saved_addresses
¶
-
MutableAddress.
shop_set
¶
-
exception
-
class
shoop.core.models.
Order
(id, shop, created_on, modified_on, identifier, label, key, reference_number, customer, orderer, billing_address, shipping_address, tax_number, phone, email, creator, modified_by, 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, _codes)¶ Bases:
shoop.utils.properties.MoneyPropped
,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.
codes
¶
-
Order.
coupon_usages
¶
-
Order.
create_full_refund
(restock_products=False)[source]¶ Create a full for entire order contents, with the option of restocking stocked products.
Parameters: restock_products (bool|False) – Boolean indicating whether to restock products
-
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_refund
(refund_data, created_by=None)[source]¶ Create a refund if passed a list of refund line data.
Refund line data is simply a list of dictionaries where each dictionary contains data for a particular refund line.
If refund line data includes a parent line, the refund is associated with that line and cannot exceed the line amount.
Additionally, if the parent line is of enum type
OrderLineType.PRODUCT
and therestock_products
boolean flag is set toTrue
, the products will be restocked with the order’s supplier the exact amount of the value of thequantity
field.Parameters: - refund_data ([dict]) – List of dicts containing refund data.
- created_by (django.contrib.auth.User|None) – Refund creator’s user instance, used for adjusting supplier stock.
-
Order.
create_shipment
(product_quantities, supplier=None, shipment=None)[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: - product_quantities (dict[shoop.shop.models.Product, decimal.Decimal]) – a dict mapping Product instances to quantities to ship
- supplier – Optional Supplier for this product. No validation is made as to whether the given supplier supplies the products.
- shipment – Optional unsaved Shipment for ShipmentProduct’s. If not given Shipment is created based on supplier parameter.
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.Shipment
-
Order.
creator
¶
-
Order.
customer
¶
-
Order.
extra_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
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_modified_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_modified_on
(*moreargs, **morekwargs)¶
-
Order.
get_previous_by_order_date
(*moreargs, **morekwargs)¶
-
Order.
get_shipping_status_display
(*moreargs, **morekwargs)¶
-
Order.
get_tax_summary
()[source]¶ Return type: taxing.TaxSummary
-
Order.
lines
¶
-
Order.
log_entries
¶
-
Order.
modified_by
¶
-
Order.
objects
= <django.db.models.manager.ManagerFromOrderQuerySet object>¶
-
Order.
orderer
¶
-
Order.
payment_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
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_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
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)¶ Bases:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
,shoop.core.pricing.Priceful
-
exception
DoesNotExist
¶
-
exception
OrderLine.
MultipleObjectsReturned
¶
-
OrderLine.
base_unit_price
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
OrderLine.
child_lines
¶
-
OrderLine.
discount_amount
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
OrderLine.
extra_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
OrderLine.
get_type_display
(*moreargs, **morekwargs)¶
-
OrderLine.
max_refundable_amount
¶ Return type: shoop.utils.money.Money
-
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)¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.core.models.ShoopModel
,shoop.core.taxing.LineTax
-
exception
DoesNotExist
¶
-
exception
OrderLineTax.
MultipleObjectsReturned
¶
-
OrderLineTax.
amount
¶ Property for a Money amount.
Will return
Money
objects when the property is being get and acceptsMoney
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 theMoneyProperty
.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 anUnitMixupError
.
-
OrderLineTax.
base_amount
¶ Property for a Money amount.
Will return
Money
objects when the property is being get and acceptsMoney
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 theMoneyProperty
.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 anUnitMixupError
.
-
OrderLineTax.
objects
= <django.db.models.manager.Manager object>¶
-
OrderLineTax.
order_line
¶
-
OrderLineTax.
tax
¶
-
exception
-
class
shoop.core.models.
OrderLineType
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
DISCOUNT
= <OrderLineType.DISCOUNT: 4>¶
-
OTHER
= <OrderLineType.OTHER: 5>¶
-
PAYMENT
= <OrderLineType.PAYMENT: 3>¶
-
PRODUCT
= <OrderLineType.PRODUCT: 1>¶
-
REFUND
= <OrderLineType.REFUND: 6>¶
-
SHIPPING
= <OrderLineType.SHIPPING: 2>¶
-
-
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.
extra
¶ A placeholder class that provides a way to set the attribute on the model.
-
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)¶ 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.
OrderStatusRole
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
CANCELED
= <OrderStatusRole.CANCELED: 3>¶
-
COMPLETE
= <OrderStatusRole.COMPLETE: 2>¶
-
INITIAL
= <OrderStatusRole.INITIAL: 1>¶
-
NONE
= <OrderStatusRole.NONE: 0>¶
-
-
class
shoop.core.models.
Payment
(id, order, created_on, gateway_id, payment_identifier, amount_value, foreign_amount_value, foreign_currency, description)¶ 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 acceptsMoney
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 theMoneyProperty
.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 anUnitMixupError
.
-
Payment.
foreign_amount
¶ Property for a Money amount.
Will return
Money
objects when the property is being get and acceptsMoney
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 theMoneyProperty
.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 anUnitMixupError
.
-
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, identifier, enabled, shop, choice_identifier, old_module_identifier, old_module_data, logo, tax_class, payment_processor)¶ Bases:
shoop.core.models.Service
-
exception
DoesNotExist
¶
-
exception
PaymentMethod.
MultipleObjectsReturned
¶
-
PaymentMethod.
behavior_components
¶
-
PaymentMethod.
contact_set
¶
-
PaymentMethod.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
PaymentMethod.
line_type
= <OrderLineType.PAYMENT: 3>¶
-
PaymentMethod.
logo
¶
-
PaymentMethod.
name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
PaymentMethod.
objects
= <django.db.models.manager.ManagerFromServiceQuerySet object>¶
-
PaymentMethod.
old_module_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
PaymentMethod.
payment_orders
¶
-
PaymentMethod.
payment_processor
¶
-
PaymentMethod.
payment_products
¶
-
PaymentMethod.
provider_attr
= 'payment_processor'¶
-
PaymentMethod.
shop
¶
-
PaymentMethod.
shop_product_m2m
= 'payment_methods'¶
-
PaymentMethod.
tax_class
¶
-
PaymentMethod.
translations
¶
-
exception
-
class
shoop.core.models.
PaymentProcessor
(*args, **kwargs)¶ Bases:
shoop.core.models.ServiceProvider
Service provider interface for payment processing.
Services provided by a payment processor are
payment methods
. To create a new payment method for a payment processor, use thecreate_service
method.Implementers of this interface will provide provide a list of payment service choices and each related payment method should have one of those service choices assigned to it.
Payment processing is handled with
get_payment_process_response
andprocess_payment_return_request
methods.Note:
PaymentProcessor
objects should never be created on their own but rather through a concrete subclass.Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
PaymentProcessor.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
PaymentProcessor.
base_objects
= <parler.managers.TranslatableManager object>¶
-
PaymentProcessor.
custompaymentprocessor
¶
-
PaymentProcessor.
get_payment_process_response
(service, order, urls)[source]¶ Get payment process response for given order.
Return type: django.http.HttpResponse|None
-
PaymentProcessor.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
PaymentProcessor.
paymentmethod_set
¶
-
PaymentProcessor.
polymorphic_primary_key_name
= 'id'¶
-
PaymentProcessor.
polymorphic_super_sub_accessors_replaced
= False¶
-
PaymentProcessor.
process_payment_return_request
(service, order, request)[source]¶ Process payment return request for given order.
Should set
order.payment_status
. Default implementation just sets it toDEFERRED
if it isNOT_PAID
.Return type: None
-
PaymentProcessor.
pseudopaymentprocessor
¶
-
PaymentProcessor.
service_model
¶ alias of
PaymentMethod
-
PaymentProcessor.
serviceprovider_ptr
¶
-
exception
-
class
shoop.core.models.
PaymentStatus
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
CANCELED
= <PaymentStatus.CANCELED: 3>¶
-
DEFERRED
= <PaymentStatus.DEFERRED: 4>¶
-
FULLY_PAID
= <PaymentStatus.FULLY_PAID: 2>¶
-
NOT_PAID
= <PaymentStatus.NOT_PAID: 0>¶
-
PARTIALLY_PAID
= <PaymentStatus.PARTIALLY_PAID: 1>¶
-
-
class
shoop.core.models.
PaymentUrls
(payment_url, return_url, cancel_url)¶ Bases:
object
Container for URLs used in payment processing.
-
class
shoop.core.models.
PersistentCacheEntry
(id, module, key, time, data)¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
PersistentCacheEntry.
MultipleObjectsReturned
¶
-
PersistentCacheEntry.
data
¶ A placeholder class that provides a way to set the attribute on the model.
-
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, merchant_notes, account_manager, contact_ptr, user, gender, birth_date, first_name, last_name)¶ Bases:
shoop.core.models.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.
contact_set
¶
-
PersonContact.
default_contact_group_identifier
= 'default_person_group'¶
-
PersonContact.
default_contact_group_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
PersonContact.
default_tax_group_getter
()¶
-
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.
name
¶
-
PersonContact.
objects
= <polymorphic.managers.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.
PolymorphicShoopModel
(*args, **kwargs)¶ Bases:
polymorphic.models.PolymorphicModel
,shoop.core.models.ShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
PolymorphicShoopModel.
base_objects
¶
-
PolymorphicShoopModel.
objects
¶
-
PolymorphicShoopModel.
polymorphic_ctype
¶
-
PolymorphicShoopModel.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
class
shoop.core.models.
PolymorphicTranslatableShoopModel
(*args, **kwargs)¶ Bases:
shoop.core.models.PolymorphicShoopModel
,shoop.core.models.TranslatableShoopModel
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
PolymorphicTranslatableShoopModel.
base_objects
¶
-
PolymorphicTranslatableShoopModel.
objects
¶
-
PolymorphicTranslatableShoopModel.
polymorphic_ctype
¶
-
PolymorphicTranslatableShoopModel.
polymorphic_super_sub_accessors_replaced
= False¶
-
-
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)¶ Bases:
shoop.core.taxing.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.
clear_variation
()[source]¶ Fully remove variation information.
Make this product a non-variation parent.
-
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.
discountfromproduct_set
¶
-
Product.
freeproductline_set
¶
-
Product.
get_all_available_combinations
()[source]¶ Generate all available combinations of variation variables.
If the product is not a variable variation parent, the iterator is empty.
Because of possible combinatorial explosion this is a generator function. (For example 6 variables with 5 options each explodes to 15,625 combinations.)
Returns: Iterable of combination information dicts. Return type: Iterable[dict]
-
Product.
get_available_variation_results
()[source]¶ Get a dict of
combination_hash
to product ID of variable variation results.Returns: Mapping of combination hashes to product IDs Return type: dict[str, int]
-
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 childThe attribute used for sorting is
PriceInfo.price
.Return
None
ifself.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
) ifself.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 calculatedprice
andbase_price
. The calculation of prices is handled in the current pricing module.Return type: shoop.core.pricing.PriceInfo
-
Product.
get_priced_children
(context, quantity=1)[source]¶ Get child products with price infos sorted by price.
Return type: list[(Product,PriceInfo)] Returns: List of products and their price infos sorted from cheapest to most expensive.
-
Product.
get_shipping_mode_display
(*moreargs, **morekwargs)¶
-
Product.
get_shop_instance
(shop)[source]¶ Return type: shoop.core.models.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.
productfilter_set
¶
-
Product.
productsinbasketcondition_set
¶
-
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.
simplify_variation
()[source]¶ Remove variation variables from the given variation parent, turning it into a simple variation (or a normal product, if it has no children).
Parameters: product (shoop.core.models.Product) – Variation parent to not be variable any longer.
-
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) Bases:
shoop.core.taxing.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.
clear_variation
()[source] Fully remove variation information.
Make this product a non-variation parent.
-
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.
discountfromproduct_set
-
Product.
freeproductline_set
-
Product.
get_all_available_combinations
()[source] Generate all available combinations of variation variables.
If the product is not a variable variation parent, the iterator is empty.
Because of possible combinatorial explosion this is a generator function. (For example 6 variables with 5 options each explodes to 15,625 combinations.)
Returns: Iterable of combination information dicts. Return type: Iterable[dict]
-
Product.
get_all_package_children
()[source]
-
Product.
get_all_package_parents
()[source]
-
Product.
get_available_attribute_queryset
()[source]
-
Product.
get_available_variation_results
()[source] Get a dict of
combination_hash
to product ID of variable variation results.Returns: Mapping of combination hashes to product IDs Return type: dict[str, int]
-
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 childThe attribute used for sorting is
PriceInfo.price
.Return
None
ifself.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
) ifself.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 calculatedprice
andbase_price
. The calculation of prices is handled in the current pricing module.Return type: shoop.core.pricing.PriceInfo
-
Product.
get_priced_children
(context, quantity=1)[source] Get child products with price infos sorted by price.
Return type: list[(Product,PriceInfo)] Returns: List of products and their price infos sorted from cheapest to most expensive.
-
Product.
get_public_media
()[source]
-
Product.
get_shipping_mode_display
(*moreargs, **morekwargs)
-
Product.
get_shop_instance
(shop)[source] Return type: shoop.core.models.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_stocked
()[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.
productfilter_set
-
Product.
productsinbasketcondition_set
-
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.
simplify_variation
()[source] Remove variation variables from the given variation parent, turning it into a simple variation (or a normal product, if it has no children).
Parameters: product (shoop.core.models.Product) – Variation parent to not be variable any longer.
-
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)¶ 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)¶ 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.
ProductCrossSellType
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
BOUGHT_WITH
= <ProductCrossSellType.BOUGHT_WITH: 4>¶
-
COMPUTED
= <ProductCrossSellType.COMPUTED: 3>¶
-
RECOMMENDED
= <ProductCrossSellType.RECOMMENDED: 1>¶
-
RELATED
= <ProductCrossSellType.RELATED: 2>¶
-
-
class
shoop.core.models.
ProductMedia
(id, identifier, product, kind, file, external_url, ordering, enabled, public, purchased)¶ 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 notProductMediaKind.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.
ProductMediaKind
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
DOCUMENTATION
= <ProductMediaKind.DOCUMENTATION: 3>¶
-
GENERIC_FILE
= <ProductMediaKind.GENERIC_FILE: 1>¶
-
IMAGE
= <ProductMediaKind.IMAGE: 2>¶
-
SAMPLE
= <ProductMediaKind.SAMPLE: 4>¶
-
-
class
shoop.core.models.
ProductMode
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
NORMAL
= <ProductMode.NORMAL: 0>¶
-
PACKAGE_PARENT
= <ProductMode.PACKAGE_PARENT: 1>¶
-
SIMPLE_VARIATION_PARENT
= <ProductMode.SIMPLE_VARIATION_PARENT: 2>¶
-
VARIABLE_VARIATION_PARENT
= <ProductMode.VARIABLE_VARIATION_PARENT: 3>¶
-
VARIATION_CHILD
= <ProductMode.VARIATION_CHILD: 4>¶
-
-
class
shoop.core.models.
ProductPackageLink
(id, parent, child, quantity)¶ 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)¶ 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.
producttypefilter_set
¶
-
ProductType.
translations
¶
-
exception
-
class
shoop.core.models.
ProductVariationLinkStatus
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
INVISIBLE
= <ProductVariationLinkStatus.INVISIBLE: 0>¶
-
VISIBLE
= <ProductVariationLinkStatus.VISIBLE: 1>¶
-
-
class
shoop.core.models.
ProductVariationResult
(id, product, combination_hash, result, status)¶ 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)¶ 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)¶ 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.
ProductVisibility
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
VISIBLE_TO_ALL
= <ProductVisibility.VISIBLE_TO_ALL: 1>¶
-
VISIBLE_TO_GROUPS
= <ProductVisibility.VISIBLE_TO_GROUPS: 3>¶
-
VISIBLE_TO_LOGGED_IN
= <ProductVisibility.VISIBLE_TO_LOGGED_IN: 2>¶
-
-
class
shoop.core.models.
RoundingMode
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
ROUND_DOWN
= <RoundingMode.ROUND_DOWN: 'ROUND_DOWN'>¶
-
ROUND_HALF_DOWN
= <RoundingMode.ROUND_HALF_DOWN: 'ROUND_HALF_DOWN'>¶
-
ROUND_HALF_UP
= <RoundingMode.ROUND_HALF_UP: 'ROUND_HALF_UP'>¶
-
ROUND_UP
= <RoundingMode.ROUND_UP: 'ROUND_UP'>¶
-
-
class
shoop.core.models.
RoundingBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr, quant, mode)¶ Bases:
shoop.core.models.ServiceBehaviorComponent
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
RoundingBehaviorComponent.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
RoundingBehaviorComponent.
base_objects
= <django.db.models.manager.Manager object>¶
-
RoundingBehaviorComponent.
get_mode_display
(*moreargs, **morekwargs)¶
-
RoundingBehaviorComponent.
help_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
RoundingBehaviorComponent.
mode
¶ A placeholder class that provides a way to set the attribute on the model.
-
RoundingBehaviorComponent.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
RoundingBehaviorComponent.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
RoundingBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
RoundingBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
RoundingBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
exception
-
class
shoop.core.models.
SalesUnit
(id, identifier, decimals)¶ 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)¶ Bases:
shoop.core.models.ShoopModel
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 displayingSavedAddress
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.
SavedAddressRole
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
BILLING
= <SavedAddressRole.BILLING: 2>¶
-
SHIPPING
= <SavedAddressRole.SHIPPING: 1>¶
-
-
class
shoop.core.models.
SavedAddressStatus
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
DISABLED
= <SavedAddressStatus.DISABLED: 0>¶
-
ENABLED
= <SavedAddressStatus.ENABLED: 1>¶
-
-
class
shoop.core.models.
Service
(*args, **kwargs)¶ Bases:
shoop.core.models.TranslatableShoopModel
Abstract base model for services.
Each enabled service should be linked to a service provider and should have a choice identifier specified in its
choice_identifier
field. The choice identifier should be valid for the service provider, i.e. it should be one of theServiceChoice.identifier
values returned by theServiceProvider.get_service_choices
method.-
Service.
behavior_components
¶
-
Service.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Service.
get_costs
(source)[source]¶ Get costs of this service for items in given source.
Returns: description, price and tax class of the costs Return type: Iterable[ServiceCost]
-
Service.
get_effective_name
(source)[source]¶ Get effective name of the service for given order source.
By default, effective name is the same as name of this service, but if there is a service provider with a custom implementation for
get_effective_name
method, then this can be different.Return type: str
-
Service.
get_lines
(source)[source]¶ Get lines for given source.
Lines are created based on costs. Costs without description are combined to single line.
Return type: Iterable[shoop.core.order_creator.SourceLine]
-
Service.
get_total_cost
(source)[source]¶ Get total cost of this service for items in given source.
Return type: PriceInfo
Get reasons of being unavailable for given source.
Return type: Iterable[ValidationError]
-
Service.
is_available_for
(source)[source]¶ Return true if service is available for given source.
Return type: bool
-
Service.
logo
¶
-
Service.
name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Service.
objects
¶
-
Service.
old_module_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
Service.
provider
¶ Return type: shoop.core.models.ServiceProvider
-
Service.
shop
¶
-
Service.
tax_class
¶
-
-
class
shoop.core.models.
ServiceBehaviorComponent
(id, polymorphic_ctype)¶ Bases:
shoop.core.models.PolymorphicShoopModel
-
exception
DoesNotExist
¶
-
exception
ServiceBehaviorComponent.
MultipleObjectsReturned
¶
-
ServiceBehaviorComponent.
base_objects
= <django.db.models.manager.Manager object>¶
-
ServiceBehaviorComponent.
expensiveswedenbehaviorcomponent
¶
-
ServiceBehaviorComponent.
fixedcostbehaviorcomponent
¶
-
ServiceBehaviorComponent.
get_costs
(service, source)[source]¶ Return costs for for this object. This should be implemented in subclass. This method is used to calculate price for
ShippingMethod
andPaymentMethod
objects.Return type: Iterable[ServiceCost]
-
ServiceBehaviorComponent.
get_delivery_time
(service, source)[source]¶ Return type: shoop.utils.dates.DurationRange|None
Return type: Iterable[ValidationError]
-
ServiceBehaviorComponent.
groupavailabilitybehaviorcomponent
¶
-
ServiceBehaviorComponent.
help_text
= None¶
-
ServiceBehaviorComponent.
name
= None¶
-
ServiceBehaviorComponent.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ServiceBehaviorComponent.
paymentmethod_set
¶
-
ServiceBehaviorComponent.
polymorphic_ctype
¶
-
ServiceBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
ServiceBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
ServiceBehaviorComponent.
roundingbehaviorcomponent
¶
-
ServiceBehaviorComponent.
shippingmethod_set
¶
-
ServiceBehaviorComponent.
staffonlybehaviorcomponent
¶
-
ServiceBehaviorComponent.
waivingcostbehaviorcomponent
¶
-
ServiceBehaviorComponent.
weightbasedpricingbehaviorcomponent
¶
-
ServiceBehaviorComponent.
weightlimitsbehaviorcomponent
¶
-
exception
-
class
shoop.core.models.
ServiceChoice
(identifier, name)¶ Bases:
object
Choice of service provided by a service provider.
Initialize service choice.
Parameters: - identifier (str) – Internal identifier for the service. Should be unique within
a single
ServiceProvider
. - name (str) – Descriptive name of the service in currently active language.
- identifier (str) – Internal identifier for the service. Should be unique within
a single
-
class
shoop.core.models.
ServiceCost
(price, description=None, tax_class=None, base_price=None)¶ Bases:
object
A cost of a service.
One service might have several costs.
Initialize cost from values.
Note: If tax_class is specified, also description must be given.
-
price_info
¶
-
-
class
shoop.core.models.
ServiceProvider
(*args, **kwargs)¶ Bases:
shoop.core.models.PolymorphicTranslatableShoopModel
Entity that provides services.
Good examples of service providers are
Carrier
andPaymentProcessor
.When subclassing
ServiceProvider
, set value forservice_model
class attribute. It should be a model class which is subclass ofService
.Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶
-
exception
ServiceProvider.
MultipleObjectsReturned
¶
-
ServiceProvider.
base_objects
= <parler.managers.TranslatableManager object>¶
-
ServiceProvider.
base_translations
¶
-
ServiceProvider.
carrier
¶
-
ServiceProvider.
create_service
(choice_identifier, **kwargs)[source]¶ Create a service for given choice identifier.
Subclass implementation may attach some
behavior components
to the created service.Subclasses should provide implementation for
_create_service
or override this. Base class implementation calls the_create_service
method with resolvedchoice_identifier
.Parameters: choice_identifier (str|None) – Identifier of the service choice to use. If None, use the default service choice. Return type: shoop.core.models.Service
-
ServiceProvider.
get_effective_name
(service, source)[source]¶ Get effective name of the service for given order source.
Base class implementation will just return name of the given service, but that may be changed in a subclass.
Return type: str
-
ServiceProvider.
get_service_choices
()[source]¶ Get all service choices of this provider.
Subclasses should implement this method.
Return type: list[ServiceChoice]
-
ServiceProvider.
logo
¶
-
ServiceProvider.
name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
ServiceProvider.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
ServiceProvider.
paymentprocessor
¶
-
ServiceProvider.
polymorphic_ctype
¶
-
ServiceProvider.
polymorphic_primary_key_name
= 'id'¶
-
ServiceProvider.
polymorphic_super_sub_accessors_replaced
= False¶
-
ServiceProvider.
service_model
= None¶
-
exception
-
class
shoop.core.models.
Shipment
(id, order, supplier, created_on, status, tracking_code, description, volume, weight, identifier)¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
Shipment.
MultipleObjectsReturned
¶
-
Shipment.
cache_values
()[source]¶ (Re)cache
volume
andweight
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)¶ 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, identifier, enabled, shop, choice_identifier, old_module_identifier, old_module_data, logo, tax_class, carrier)¶ Bases:
shoop.core.models.Service
-
exception
DoesNotExist
¶
-
exception
ShippingMethod.
MultipleObjectsReturned
¶
-
ShippingMethod.
behavior_components
¶
-
ShippingMethod.
carrier
¶
-
ShippingMethod.
contact_set
¶
-
ShippingMethod.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
ShippingMethod.
get_shipping_time
(source)[source]¶ Get shipping time for items in given source.
Return type: shoop.utils.dates.DurationRange|None
-
ShippingMethod.
line_type
= <OrderLineType.SHIPPING: 2>¶
-
ShippingMethod.
logo
¶
-
ShippingMethod.
name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
ShippingMethod.
objects
= <django.db.models.manager.ManagerFromServiceQuerySet object>¶
-
ShippingMethod.
old_module_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
ShippingMethod.
provider_attr
= 'carrier'¶
-
ShippingMethod.
shipping_orders
¶
-
ShippingMethod.
shipping_products
¶
-
ShippingMethod.
shop
¶
-
ShippingMethod.
shop_product_m2m
= 'shipping_methods'¶
-
ShippingMethod.
tax_class
¶
-
ShippingMethod.
translations
¶
-
exception
-
class
shoop.core.models.
ShippingMode
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
NOT_SHIPPED
= <ShippingMode.NOT_SHIPPED: 0>¶
-
SHIPPED
= <ShippingMode.SHIPPED: 1>¶
-
-
class
shoop.core.models.
ShippingStatus
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
FULLY_SHIPPED
= <ShippingStatus.FULLY_SHIPPED: 2>¶
-
NOT_SHIPPED
= <ShippingStatus.NOT_SHIPPED: 0>¶
-
PARTIALLY_SHIPPED
= <ShippingStatus.PARTIALLY_SHIPPED: 1>¶
-
-
class
shoop.core.models.
ShoopModel
(*args, **kwargs)¶ Bases:
django.db.models.base.Model
Shoop Model.
-
ShoopModel.
identifier_attr
= 'identifier'¶
-
-
class
shoop.core.models.
Shop
(id, identifier, domain, status, owner, options, currency, prices_include_tax, logo, maintenance_mode, contact_address)¶ Bases:
shoop.core.models._base.ChangeProtected
,shoop.core.models.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
Shop.
MultipleObjectsReturned
¶
-
Shop.
basketcampaign_set
¶
-
Shop.
catalogcampaign_set
¶
-
Shop.
categories
¶
-
Shop.
cgpprice_set
¶
-
Shop.
change_protect_message
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
Shop.
contact_address
¶
-
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.
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.
options
¶ A placeholder class that provides a way to set the attribute on the model.
-
Shop.
order_set
¶
-
Shop.
owner
¶
-
Shop.
paymentmethod_set
¶
-
Shop.
product_media
¶
-
Shop.
protected_fields
= ['currency', 'prices_include_tax']¶
-
Shop.
public_name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Shop.
shippingmethod_set
¶
-
Shop.
shop_products
¶
-
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, minimum_price_value)¶ 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 hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
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.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.
minimum_price
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
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.
ShopStatus
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
DISABLED
= <ShopStatus.DISABLED: 0>¶
-
ENABLED
= <ShopStatus.ENABLED: 1>¶
-
-
class
shoop.core.models.
StaffOnlyBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr)¶ Bases:
shoop.core.models.ServiceBehaviorComponent
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
StaffOnlyBehaviorComponent.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
StaffOnlyBehaviorComponent.
base_objects
= <django.db.models.manager.Manager object>¶
-
StaffOnlyBehaviorComponent.
help_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
StaffOnlyBehaviorComponent.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
StaffOnlyBehaviorComponent.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
StaffOnlyBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
StaffOnlyBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
StaffOnlyBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
exception
-
class
shoop.core.models.
StockBehavior
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
STOCKED
= <StockBehavior.STOCKED: 1>¶
-
UNSTOCKED
= <StockBehavior.UNSTOCKED: 0>¶
-
-
class
shoop.core.models.
SuppliedProduct
(id, supplier, product, sku, alert_limit, physical_count, logical_count)¶ 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)¶ Bases:
shoop.core.modules.interface.ModuleInterface
,shoop.core.models.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_suppliable_products
(shop, customer)[source]¶ Parameters: - shop (shoop.core.models.Shop) – Shop to check for suppliability
- customer (shoop.core.models.Contact) – Customer contact to check for suppliability
Return type: list[int]
-
Supplier.
get_type_display
(*moreargs, **morekwargs)¶
-
Supplier.
module_data
¶ A placeholder class that provides a way to set the attribute on the model.
-
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.
SupplierType
¶ Bases:
enumfields.enums.Enum
An enumeration.
-
EXTERNAL
= <SupplierType.EXTERNAL: 2>¶
-
INTERNAL
= <SupplierType.INTERNAL: 1>¶
-
-
class
shoop.core.models.
Tax
(id, code, rate, amount_value, currency, enabled)¶ Bases:
shoop.utils.properties.MoneyPropped
,shoop.core.models._base.ChangeProtected
,shoop.core.models.TranslatableShoopModel
-
exception
DoesNotExist
¶
-
exception
Tax.
MultipleObjectsReturned
¶
-
Tax.
amount
¶ Property for a Money amount.
Will return
Money
objects when the property is being get and acceptsMoney
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 theMoneyProperty
.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 anUnitMixupError
.
-
Tax.
calculate_amount
(base_amount)[source]¶ Calculate tax amount with this tax for given base amount.
Return type: shoop.utils.money.Money
-
Tax.
change_protect_message
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
Tax.
identifier_attr
= 'code'¶
-
Tax.
name
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Tax.
objects
= <parler.managers.TranslatableManager object>¶
-
Tax.
order_line_taxes
¶
-
Tax.
taxrule_set
¶
-
Tax.
translations
¶
-
Tax.
unprotected_fields
= ['enabled']¶
-
exception
-
class
shoop.core.models.
TaxClass
(id, identifier, enabled)¶ Bases:
shoop.core.models.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.
TranslatableShoopModel
(*args, **kwargs)¶ Bases:
shoop.core.models.ShoopModel
,parler.models.TranslatableModel
-
TranslatableShoopModel.
name_attr
= 'name'¶
-
TranslatableShoopModel.
objects
¶
-
-
class
shoop.core.models.
WaivingCostBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr, price_value, waive_limit_value)¶ Bases:
shoop.core.models._service_base.TranslatableServiceBehaviorComponent
-
exception
DoesNotExist
¶
-
exception
WaivingCostBehaviorComponent.
MultipleObjectsReturned
¶
-
WaivingCostBehaviorComponent.
base_objects
= <parler.managers.TranslatableManager object>¶
-
WaivingCostBehaviorComponent.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
WaivingCostBehaviorComponent.
help_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
WaivingCostBehaviorComponent.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
WaivingCostBehaviorComponent.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
WaivingCostBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
WaivingCostBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
WaivingCostBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
WaivingCostBehaviorComponent.
translations
¶
-
exception
-
class
shoop.core.models.
WeightBasedPriceRange
(id, component, min_value, max_value, price_value)¶ Bases:
parler.models.TranslatableModel
-
exception
DoesNotExist
¶
-
exception
WeightBasedPriceRange.
MultipleObjectsReturned
¶
-
WeightBasedPriceRange.
component
¶
-
WeightBasedPriceRange.
description
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
WeightBasedPriceRange.
objects
= <parler.managers.TranslatableManager object>¶
-
WeightBasedPriceRange.
translations
¶
-
exception
-
class
shoop.core.models.
WeightBasedPricingBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr)¶ Bases:
shoop.core.models.ServiceBehaviorComponent
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
WeightBasedPricingBehaviorComponent.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
WeightBasedPricingBehaviorComponent.
base_objects
= <django.db.models.manager.Manager object>¶
-
WeightBasedPricingBehaviorComponent.
help_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
WeightBasedPricingBehaviorComponent.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
WeightBasedPricingBehaviorComponent.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
WeightBasedPricingBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
WeightBasedPricingBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
WeightBasedPricingBehaviorComponent.
ranges
¶
-
WeightBasedPricingBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
exception
-
class
shoop.core.models.
WeightLimitsBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr, min_weight, max_weight)¶ Bases:
shoop.core.models.ServiceBehaviorComponent
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
WeightLimitsBehaviorComponent.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
WeightLimitsBehaviorComponent.
base_objects
= <django.db.models.manager.Manager object>¶
-
WeightLimitsBehaviorComponent.
help_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
WeightLimitsBehaviorComponent.
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
WeightLimitsBehaviorComponent.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
WeightLimitsBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
WeightLimitsBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
WeightLimitsBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
exception
-
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¶
-
-
shoop.core.order_creator.
get_order_source_modifier_modules
()¶ Get a list of configured order source modifier module instances.
Return type: list[OrderSourceModifierModule]
-
shoop.core.order_creator.
is_code_usable
(order_source, code)¶
-
class
shoop.core.order_creator.
OrderCreator
(request=None)¶ Bases:
shoop.core.order_creator._creator.OrderProcessor
Initialize order creator.
Parameters: request (django.http.HttpRequest|None) – Optional request object for backward compatibility. Passing non-None value is DEPRECATED.
-
class
shoop.core.order_creator.
OrderModifier
¶ Bases:
shoop.core.order_creator._creator.OrderProcessor
-
class
shoop.core.order_creator.
OrderSource
(shop)¶ 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 anOrderSource
.No objects held here need be saved, but they may be.
-
add_code
(code)[source]¶ Add code to this OrderSource.
At this point it is expected that the customers permission to use the code has already been checked by the caller.
The code will be converted to text.
Parameters: code (str) – The code to add Returns: True if code was added, False if it was already there Return type: bool
-
clear_codes
()[source]¶ Remove all codes from this OrderSource.
Returns: True iff there was codes before clearing Return type: bool
-
codes
¶
-
creator
¶
-
customer
¶
-
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 thepost_compute_source_lines
signal.Note
By default, taxes for the returned lines are not calculated when
self.calculate_taxes_automatically
is false. Pass inTrue
towith_taxes
argument or usecalculate_taxes
method to force tax calculation.
-
get_lines
()[source]¶ Get unprocessed lines in this OrderSource.
See also
get_final_lines
.
-
get_product_lines
()[source]¶ Get lines with a product.
This does not use get_final_lines because it will be called when final lines is being computed (for example to determine shipping discounts based on the total price of all products).
-
is_empty
¶
-
modified_by
¶
-
orderer
¶
-
payment_method
¶
-
product_count
¶ Get the total number of products in this OrderSource.
Return type: decimal.Decimal|int
-
product_ids
¶
-
remove_code
(code)[source]¶ Remove given code from this OrderSource.
Parameters: code (str) – The code to remove Returns: True if code was removed, False if code was not there Return type: bool
-
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_gross_weight
¶
-
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.
OrderSourceModifierModule
¶ Bases:
object
-
class
shoop.core.order_creator.
SourceLine
(source, **kwargs)¶ Bases:
shoop.core.taxing.TaxableItem
,shoop.core.pricing.Priceful
Line of OrderSource.
Note: Properties like price, taxful_price, tax_rate, etc. are inherited from the
Priceful
mixin.Initialize SourceLine with given source and data.
Parameters: - source (OrderSource) – The
OrderSource
thisSourceLine
belongs to. - kwargs – Data for the
SourceLine
.
-
base_unit_price
= None¶
-
discount_amount
= None¶
-
classmethod
from_dict
(source, data)[source]¶ Create SourceLine from given OrderSource and dict.
Return type: cls
-
parent_line
¶
-
quantity
= None¶
-
tax_amount
¶ Return type: shoop.utils.money.Money
-
tax_class
¶
-
taxes
¶ Taxes of this line.
Determined by a TaxModule in
OrderSource.calculate_taxes
.Return type: list[shoop.core.taxing.LineTax]
- source (OrderSource) – The
-
class
shoop.core.pricing.default_pricing.
DefaultPricingModule
[source]¶ Bases:
shoop.core.pricing.PricingModule
-
identifier
= 'default_pricing'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
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.customer_group_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.
DiscountModule
¶ Bases:
object
-
discount_price
(context, product, price_info)[source]¶ Discount given price of given product.
Parameters: - context (shoop.core.pricing.PricingContext) – Pricing context to operate in
- product (shoop.core.models.Product|int) – Product in question or its id
- price_info (shoop.core.pricing.PriceInfo) – Price to discount
Returns: Discounted price
Return type:
-
discount_prices
(context, products, price_infos)[source]¶ Discount a bunch of prices.
Parameters: - context (shoop.core.pricing.PricingContext) – Pricing context to operate in
- products (Iterable[shoop.core.models.Product|int]) – Products in question or their ids
Return type: dict[int,PriceInfo]
-
get_pricing_steps
(context, product, steps)[source]¶ Get discounted pricing steps for given product.
Base class version just discounts all the given steps with
discount_price
, but another module could add more steps and should do so, if the module introduces any pricing steps.Parameters: - context (shoop.core.pricing.PricingContext) – Pricing context to operate in
- product (shoop.core.models.Product|int) – Product in question or its id
Return type: list[PriceInfo]
-
get_pricing_steps_for_products
(context, products, steps)[source]¶ Get discounted pricing steps for a bunch of products.
Parameters: - context (shoop.core.pricing.PricingContext) – Pricing context to operate in
- products (Iterable[shoop.core.models.Product|int]) – Products in question or their ids
Return type: dict[int,list[PriceInfo]]
-
-
shoop.core.pricing.
get_discount_modules
()¶ Get a list of configured discount module instances.
Return type: list[DiscountModule]
-
shoop.core.pricing.
get_price_info
(context, product, quantity=1)¶ Get price info of product for given quantity.
Returned
PriceInfo
object contains calculatedprice
andbase_price
. The calculation of prices is handled in the current pricing module and possibly configured discount modules.Parameters: product (shoop.core.models.Product|int) – Product
object or id ofProduct
Return type: shoop.core.pricing.PriceInfo
-
shoop.core.pricing.
get_price_infos
(context, products, quantity=1)¶ 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.Parameters: products (Iterable[shoop.core.models.Product|int]) – List of product objects or id’s Return type: dict[int,PriceInfo]
-
shoop.core.pricing.
get_pricing_module
()¶ Return type: shoop.core.pricing.PricingModule
-
shoop.core.pricing.
get_pricing_steps
(context, product)¶ Get context-specific list pricing steps for the given product.
Returns a list of PriceInfos, see
PricingModule.get_pricing_steps
for description of its format.Parameters: product (shoop.core.models.Product|int) – Product or product id Return type: list[shoop.core.pricing.PriceInfo]
-
shoop.core.pricing.
get_pricing_steps_for_products
(context, products)¶ 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.Parameters: products (Iterable[shoop.core.models.Product|int]) – List of product objects or id’s Return type: dict[int,list[PriceInfo]]
-
class
shoop.core.pricing.
Price
¶ 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 theirvalue
andcurrency
. To get the bare Money amount of aPrice
, use theamount
property.-
includes_tax
= None¶
-
-
class
shoop.core.pricing.
PriceDisplayOptions
(include_taxes=None, show_prices=True)¶ Bases:
object
Price display options.
Parameters on how prices should be rendered.
Initialize price display options.
Parameters: - include_taxes (bool|None) – Whether include taxes to rendered prices or not. If None, show prices in their original taxness.
- show_prices (bool) – Whether show prices at all.
-
classmethod
from_context
(context)[source]¶ Get price display options from context.
Return type: PriceDisplayOptions
-
hide_prices
¶
-
class
shoop.core.pricing.
Priceful
¶ Bases:
object
Mixin to define price properties based on other price properties.
You must provide at least
quantity
(Decimal
)
and both
or both
You may also provide
tax_amount
(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.
Normally positive or zero, but might also be negative if product is being sold with higher price than its normal price.
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_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_unit_discount_amount
¶ Taxless
unit_discount_amount
-
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)¶ Bases:
shoop.core.pricing.Priceful
Object for passing around pricing data of an item.
Initialize PriceInfo with prices and other parameters.
Prices can be taxful or taxless, but their types must match.
Parameters: - price (Price) – Effective price for the specified quantity.
- base_price (Price) – Base price for the specified quantity. Discounts are calculated based on this.
- quantity (numbers.Number) – Quantity that the given price is for. Unit price is
calculated by
discounted_unit_price = price / quantity
. Note: Quantity could be non-integral (i.e. decimal). - expires_on (numbers.Number|None) – Timestamp, comparable to values returned by
time.time
, determining the point in time when the prices are no longer valid, or None if no expire time is set (which could mean indefinitely, but in reality, it just means undefined).
-
base_price
= None¶
-
price
= None¶
-
quantity
= None¶
-
class
shoop.core.pricing.
PricingContext
(shop, customer, time=None)¶ Bases:
shoop.core.pricing.PricingContextable
Context for pricing.
Initialize pricing context for shop and customer.
-
class
shoop.core.pricing.
PricingContextable
¶ Bases:
object
Object that is or can be converted to a pricing context.
Currently there exists two kind of
PricingContextable
objects:PricingContext`(and its subclasses) and `HttpRequest
.Note
Expression
isinstance(request, PricingContextable)
will return True for arequest
which isHttpRequest
, becauseHttpRequest
is registered as a subclass of this abstract base class.This abstract base class is just a helper to allow writing simpler type specifiers, since we want to allow passing
HttpRequest
as a pricing context even though it is not aPricingContext
.
-
class
shoop.core.pricing.
PricingModule
¶ Bases:
object
-
get_context
(context)[source]¶ Create pricing context from pricing contextable object.
Return type: PricingContext
-
get_context_from_data
(shop, customer, time=None, **kwargs)[source]¶ Create pricing context from given arguments.
Return type: PricingContext
-
get_context_from_request
(request)[source]¶ Create pricing context from HTTP request.
This base class implementation does not use
request
at all.Return type: PricingContext
-
get_price_info
(context, product, quantity=1)[source]¶ Get price info of product for given quantity.
Parameters: product (shoop.core.models.Product|int) – Product
object or id ofProduct
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]) – List of product objects 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]) – List of product objects or id’s Return type: dict[int,list[PriceInfo]]
-
identifier
= None¶
-
name
= None¶
-
pricing_context_class
¶ alias of
PricingContext
-
-
class
shoop.core.pricing.
TaxfulPrice
¶ Bases:
shoop.core.pricing.Price
Price which includes taxes.
Check the base class,
Price
, for more info.-
includes_tax
= True¶
-
-
class
shoop.core.pricing.
TaxlessPrice
¶ Bases:
shoop.core.pricing.Price
Price which does not include taxes.
Check the base class,
Price
, for more info.-
includes_tax
= False¶
-
-
shoop.core.shortcuts.
update_order_line_from_product
(pricing_context, order_line, product, quantity=1, supplier=None)[source]¶ Update OrderLine data from a product.
This is a convenience method for simple applications.
Parameters: pricing_context (shoop.core.pricing.PricingContextable|None) – Pricing context to use for pricing the line. If None is given, the line will get zero price and zero discount amount.
-
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.
-
identifier
= None¶
-
name
= None¶
-
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]
-
get_stock_status
(product_id)[source]¶ Parameters: product_id (int) – Product ID Return type: shoop.core.stocks.ProductStockStatus
-
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]
-
-
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¶
-
-
shoop.core.taxing.utils.
get_tax_class_proportions
(lines)[source]¶ Generate tax class proportions from taxed lines.
Sum prices per tax class and return a list of (tax_class, factor) pairs, where factor is the proportion of total price of lines with given tax class from the total price of all lines.
Parameters: lines (list[shoop.core.order_creator.SourceLine]) – List of taxed lines to generate proportions from Return type: list[(shoop.core.models.TaxClass, decimal.Decimal)] Returns: List of tax classes with a proportion, or empty list if total price is zero. Sum of proportions is 1.
-
shoop.core.taxing.utils.
stacked_value_added_taxes
(price, taxes)[source]¶ Stack added taxes on the given price without compounding.
Note that this will not take compound taxation (Quebec) into account.
Parameters: - price (shoop.core.pricing.Price) – Taxful or taxless price to calculate taxes for
- taxes (list[shoop.core.models.Tax]) – List of Tax objects
Returns: TaxedPrice with the calculated taxes.
Return type:
-
shoop.core.taxing.utils.
calculate_compounded_added_taxes
(price, tax_groups)[source]¶ Calculate compounded and added taxes from given groups of taxes.
The
tax_groups
argument should be a list of tax groups, where each tax group is a list ofTax
objects. Taxes in each tax group will be added together and finally each added tax group will be compounded over each other.Parameters: - price (shoop.core.pricing.Price) – Taxful or taxless price to calculate taxes for
- tax_groups (list[list[shoop.core.models.Tax]]) – List of tax groups, each being a list of taxes
Returns: TaxedPrice with the calculated taxes.
Return type:
-
class
shoop.core.taxing.
LineTax
¶ Bases:
object
Tax of some line.
This is an interface for specifying taxes of an
OrderLine
orSourceLine
.-
classmethod
from_tax
(tax, base_amount, **kwargs)[source]¶ Create tax line for given tax and base amount.
-
rate
¶
-
classmethod
-
class
shoop.core.taxing.
SourceLineTax
(tax, name, amount, base_amount)¶ Bases:
shoop.core.taxing.LineTax
Initialize line tax from given values.
-
class
shoop.core.taxing.
TaxModule
¶ Bases:
object
Module for calculating taxes.
-
add_taxes
(source, lines)[source]¶ Add taxes to given OrderSource lines.
Given lines are modified in-place, also new lines may be added (with
lines.extend
for example). If there is any existing taxes for thelines
, they are simply replaced.Parameters: - source (shoop.core.order_creator.OrderSource) – OrderSource of the lines
- lines (list[shoop.core.order_creator.SourceLine]) – List of lines to add taxes for
-
calculating_is_cheap
= True¶
-
get_taxed_price
(context, price, tax_class)[source]¶ Get TaxedPrice for price and tax class.
Parameters: - context (TaxingContext) – Taxing context to calculate in
- price (shoop.core.pricing.Price) – Price (taxful or taxless) to calculate taxes for
- tax_class (shoop.core.models.TaxClass) – Tax class of the item to get taxes for
Return type:
-
get_taxed_price_for
(context, item, price)[source]¶ Get TaxedPrice for taxable item.
Taxable items could be products (
Product
), services (Service
), or lines (SourceLine
).Parameters: - context (TaxingContext) – Taxing context to calculate in
- item (shoop.core.taxing.TaxableItem) – Item to get taxes for
- price (shoop.core.pricing.Price) – Price (taxful or taxless) to calculate taxes for
Return type:
-
identifier
= None¶
-
name
= None¶
-
taxing_context_class
¶ alias of
TaxingContext
-
-
class
shoop.core.taxing.
TaxSummary
¶ Bases:
list
-
classmethod
from_line_taxes
(line_taxes, untaxed)[source]¶ Create TaxSummary from LineTaxes.
Parameters: - line_taxes (list[LineTax]) – List of line taxes to summarize
- untaxed (shoop.core.pricing.TaxlessPrice) – Sum of taxless prices that have no taxes added
-
classmethod
-
class
shoop.core.taxing.
TaxableItem
¶ Bases:
object
-
tax_class
¶ Return type: shoop.core.models.TaxClass
-
-
class
shoop.core.taxing.
TaxedPrice
(taxful, taxless, taxes=None)¶ Bases:
object
Price with calculated taxes.
-
taxful
¶ (
TaxfulPrice
) Price including taxes.
-
taxless
¶ (
TaxlessPrice
) Pretax price.
-
taxes
¶ (
list[shoop.core.taxing.LineTax]
) List of taxes applied to the price.
Initialize from given prices and taxes.
Parameters: - taxful (shoop.core.pricing.TaxfulPrice) – Price including taxes.
- taxless (shoop.core.pricing.TaxlessPrice) – Pretax price.
- taxes (list[shoop.core.taxing.LineTax]|None) – List of taxes applied to the price.
-
tax_amount
¶ Total amount of applied taxes.
-
tax_rate
¶ Tax rate calculated from taxful and taxless amounts.
-
-
class
shoop.core.taxing.
TaxingContext
(customer_tax_group=None, customer_tax_number=None, location=None)¶ Bases:
object
-
shoop.core.taxing.
get_tax_module
()¶ Get the TaxModule specified in settings.
Return type: shoop.core.taxing.TaxModule
-
shoop.core.taxing.
should_calculate_taxes_automatically
()¶ If
settings.SHOOP_CALCULATE_TAXES_AUTOMATICALLY_IF_POSSIBLE
is False taxes shouldn’t be calculated automatically otherwise use current tax module valueTaxModule.calculating_is_cheap
to determine whether taxes should be calculated automatically.Return type: bool
Template tags for displaying prices correctly.
Prefer these filters for rendering prices of products and basket lines
or total price of basket, since the will take price display options of
current template context into account (see PriceDisplayOptions
).
Especially, they convert prices to correct taxness.
There is also a global context function show_prices
which can be used
to render certain price container elements conditionally.
Return true if price display options has show prices enabled.
Common helpers for Shoop templates.
Note
In addition to these, also the price rendering tags from
shoop.core.templatetags.prices
module are available.
Get language choices as code and text in two languages.
Returns: Available language codes as tuples (code, name, local_name) where name is in the currently active language, and local_name is in the language of the item. Return type: Iterable[tuple[str,str,str]]
Format money amount according to current locale settings.
Parameters: - amount (shoop.utils.money.Money) – Money or Price object to format
- digits (int|None) – Number of digits to use, by default use locale’s default
- widen (int) – Number of extra digits to add; for formatting with additional
precision, e.g.
widen=3
will use 5 digits instead of 2
Returns: Formatted string representing the given amount
Return type:
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"
)
-
class
shoop.core.utils.form_mixins.
ProtectedFieldsMixin
(**kwargs)[source]¶ Bases:
object
-
change_protect_field_text
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
clean_protected_fields
(cleaned_data)[source]¶ Ignore protected fields (they are set to
disabled
, so they will not be in the form data).As a side effect, this removes the fields from
changed_data
too.Parameters: cleaned_data (dict) – Cleaned data Returns: Cleaned data without protected field data Return type: dict
-
Utilities for displaying prices correctly.
Contents:
- Class
PriceDisplayOptions
for storing the display options.- Helper function
render_price_property
for rendering prices correctly from Python code.- Various filter classes for implementing Jinja2 filters.
-
shoop.core.utils.price_display.
render_price_property
(request, item, priceful, property_name='price')[source]¶ Render price property of a Priceful object.
Return type: str
-
class
shoop.core.utils.price_display.
PriceDisplayFilter
(name, property_name=None)[source]¶ Bases:
shoop.core.utils.price_display._ContextFilter
-
class
shoop.core.utils.price_display.
PricePropertyFilter
(name, property_name=None)[source]¶ Bases:
shoop.core.utils.price_display._ContextFilter
-
class
shoop.core.utils.price_display.
PricePercentPropertyFilter
(name, property_name=None)[source]¶ Bases:
shoop.core.utils.price_display._ContextFilter
-
shoop.core.utils.prices.
convert_taxness
(request, item, priceful, with_taxes)[source]¶ Convert taxness of a priceful object.
Return a
Priceful
objectresult
satisfyingresult.price.includes_tax == with_taxes
if possible.When given
priceful
does not have tax amount and taxes cannot be calculated automatically (should_calculate_taxes_automatically
returns false), return the givenpriceful
as is.Given
request
is used for constructing aTaxingContext
.Return type: shoop.core.pricing.Priceful
-
class
shoop.core.utils.prices.
TaxedPriceInfo
(price, base_price, quantity, tax_amount, **kwargs)[source]¶ Bases:
shoop.core.pricing.PriceInfo
-
shoop.core.utils.tax_numbers.
validate
(tax_number)[source]¶ Validate a tax number.
Parameters: tax_number (str) – Tax number to validate Returns: Type identifier of the tax number, if detected. Possible values for now are either “vat” or “unknown”. Return type: str Raise: ValidationError
if tax number type was detected, but it is somehow malformed.
-
exception
shoop.core.utils.vat.
VatValidationError
(*args, **kwargs)[source]¶ Bases:
django.core.exceptions.ValidationError
-
code
= None¶
-
-
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'¶
-
-
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.
ProductNotOrderableProblem
(message, title=None)[source]¶ Bases:
shoop.utils.excs.Problem
-
exception
shoop.core.excs.
ProductNotVisibleProblem
(message, title=None)[source]¶ Bases:
shoop.utils.excs.Problem
-
exception
shoop.core.excs.
ImpossibleProductModeException
(message, code=None)[source]¶ Bases:
ValueError
-
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_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_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_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_LENGTH
= 10¶ The length of reference numbers generated by certain reference number generators.
-
shoop.core.settings.
SHOOP_REFERENCE_NUMBER_PREFIX
= ''¶ An arbitrary (numeric) prefix for certain reference number generators.
-
shoop.core.settings.
SHOOP_PRICING_MODULE
= 'customer_group_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_DISCOUNT_MODULES
= ['catalog_campaigns']¶ List of identifiers of discount modules to use.
Each discount module may change the price of a product. See
shoop.core.pricing.DiscountModule
for details.
-
shoop.core.settings.
SHOOP_ORDER_SOURCE_MODIFIER_MODULES
= ['basket_campaigns']¶ List of identifiers of order source modifier modules.
See
shoop.core.order_creator.OrderSourceModifierModule
for details.
-
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_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_ENABLE_MULTIPLE_SUPPLIERS
= False¶ Whether multiple suppliers are enabled in this installation. Enabling this flag prevents supplier creation from admin.
-
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_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_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_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_TELEMETRY_ENABLED
= True¶ A flag to enable/disable the telemetry system
-
shoop.core.settings.
SHOOP_TELEMETRY_URL
= 'https://telemetry.shoop.io/collect/'¶ The submission URL for Shoop’s telemetry (statistics) system
-
shoop.core.settings.
SHOOP_DEFAULT_CACHE_DURATION
= 1800¶ Default cache duration for various caches in seconds
-
shoop.core.settings.
SHOOP_CACHE_DURATIONS
= {}¶ Overrides for default cache durations by key namespace. These override possible defaults in
shoop.core.cache.impl.DEFAULT_CACHE_DURATIONS
.
-
shoop.core.settings.
SHOOP_CALCULATE_TAXES_AUTOMATICALLY_IF_POSSIBLE
= True¶ Whether taxes should be calculated automatically in TaxModule
-
shoop.core.telemetry.
get_installation_key
()[source]¶ Get the unique installation ID for this Shoop instance.
If one doesn’t exist, it’s generated and saved at this point.
Returns: Installation key string Return type: str
-
shoop.core.telemetry.
is_in_grace_period
()[source]¶ Return True if the telemetry module is within the 24-hours-from-installation grace period where no stats are sent. This is to “safely” allow opting out of telemetry without leaving a trace.
Returns: Graceness flag. Return type: bool
-
shoop.core.telemetry.
set_opt_out
(flag)[source]¶ Set whether this installation is opted-out from telemetry submissions.
Parameters: flag (bool) – Opt-out flag. True for opt-out, false for opt-in (default) Returns: New flag state Return type: bool
-
shoop.core.telemetry.
save_telemetry_submission
(data)[source]¶ Save a blob of data as the latest telemetry submission.
Naturally updates the latest submission time.
Parameters: data (dict) – A blob of data.
-
shoop.core.telemetry.
get_telemetry_data
(request, indent=None)[source]¶ Get the telemetry data that would be sent.
Parameters: request (django.http.HttpRequest|None) – HTTP request. Optional. Returns: Data blob. Return type: str
-
shoop.core.telemetry.
try_send_telemetry
(request=None, max_age_hours=72, raise_on_error=False)[source]¶ Send telemetry information (unless opted-out, in grace period or disabled).
Parameters: - request (django.http.HttpRequest|None) – HTTP request. Optional.
- max_age_hours (int|None) – How many hours must have passed since the last submission to be able to resend. If None, not checked.
- raise_on_error (bool) – Raise exceptions when telemetry is not sent instead of quietly returning False.
Returns: Sent data (possibly with response information) or False if not sent.
Return type: dict|bool
-
class
shoop.core.
ShoopCoreAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.core'¶
-
verbose_name
= 'Shoop Core'¶
-
label
= 'shoop'¶
-
required_installed_apps
= ('django.contrib.auth', 'django.contrib.contenttypes', 'easy_thumbnails', 'filer')¶
-
provides
= {'pricing_module': ['shoop.core.pricing.default_pricing:DefaultPricingModule'], 'api_populator': ['shoop.core.api:populate_core_api']}¶
-
-
class
shoop.customer_group_pricing.models.
CgpPrice
(id, product, shop, group, price_value)[source]¶ Bases:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
product
¶
-
shop
¶
-
group
¶
-
price
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
exception
DoesNotExist
¶
-
exception
CgpPrice.
MultipleObjectsReturned
¶
-
CgpPrice.
objects
= <django.db.models.manager.Manager object>¶
-
-
class
shoop.customer_group_pricing.
CustomerGroupPricingAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.customer_group_pricing'¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
label
= 'shoop_customer_group_pricing'¶
-
provides
= {'admin_product_form_part': ['shoop.customer_group_pricing.admin_form_part:CustomerGroupPricingFormPart'], 'pricing_module': ['shoop.customer_group_pricing.module:CustomerGroupPricingModule'], 'api_populator': ['shoop.customer_group_pricing.api:populate_customer_group_pricing_api']}¶
-
-
class
shoop.default_tax.admin_module.views.
TaxRuleForm
(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
-
model
¶ alias of
TaxRule
-
fields
= ['tax_classes', 'customer_tax_groups', 'country_codes_pattern', 'region_codes_pattern', 'postal_codes_pattern', 'priority', 'override_group', 'tax', 'enabled']¶
-
help_texts
= {'region_codes_pattern': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3ce721b38>, 'country_codes_pattern': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3ce6209e8>, 'postal_codes_pattern': <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d44fcd30>}¶
-
-
TaxRuleForm.
base_fields
= OrderedDict([('tax_classes', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3ce9acb70>), ('customer_tax_groups', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3cf088e10>), ('country_codes_pattern', <django.forms.fields.CharField object at 0x7ff3d5945470>), ('region_codes_pattern', <django.forms.fields.CharField object at 0x7ff3d5906a20>), ('postal_codes_pattern', <django.forms.fields.CharField object at 0x7ff3cee24898>), ('priority', <django.forms.fields.IntegerField object at 0x7ff3d5959da0>), ('override_group', <django.forms.fields.IntegerField object at 0x7ff3ceedbb38>), ('tax', <django.forms.models.ModelChoiceField object at 0x7ff3ce6140f0>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3cf0ca400>)])¶
-
TaxRuleForm.
declared_fields
= OrderedDict()¶
-
TaxRuleForm.
media
¶
-
class
-
class
shoop.default_tax.admin_module.views.
TaxRuleEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
TaxRule
-
template_name
= 'shoop/default_tax/admin/edit.jinja'¶
-
form_class
¶ alias of
TaxRuleForm
-
context_object_name
= 'tax_rule'¶
-
add_form_errors_as_messages
= True¶
-
-
class
shoop.default_tax.admin_module.views.
TaxRuleListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
TaxRule
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3ce4ee8d0>, <shoop.admin.utils.picotable.Column object at 0x7ff3cf1d3358>, <shoop.admin.utils.picotable.Column object at 0x7ff3cef7d8d0>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce48a198>, <shoop.admin.utils.picotable.Column object at 0x7ff3cf9e4f28>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce4d46a0>, <shoop.admin.utils.picotable.Column object at 0x7ff3cf3aa668>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce48a5f8>, <shoop.admin.utils.picotable.Column object at 0x7ff3cee693c8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d5933668>]¶
-
-
class
shoop.default_tax.models.
TaxRuleQuerySet
(model=None, query=None, using=None, hints=None)[source]¶
-
class
shoop.default_tax.models.
TaxRule
(id, enabled, country_codes_pattern, region_codes_pattern, postal_codes_pattern, _postal_codes_min, _postal_codes_max, priority, override_group, tax)[source]¶ Bases:
django.db.models.base.Model
-
tax_classes
¶
-
customer_tax_groups
¶
-
tax
¶
-
objects
= <django.db.models.manager.ManagerFromTaxRuleQuerySet object>¶
-
exception
DoesNotExist
¶
-
exception
TaxRule.
MultipleObjectsReturned
¶
-
-
class
shoop.default_tax.module.
DefaultTaxModule
[source]¶ Bases:
shoop.core.taxing.TaxModule
-
identifier
= 'default_tax'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
shoop.default_tax.module.
get_taxes_of_effective_rules
(taxing_context, tax_rules)[source]¶ Get taxes grouped by priority from effective tax rules.
Effective tax rules is determined by first limiting the scope to the rules that match the given taxing context (see
TaxRule.match
) and then further limiting the matching rules by selecting only the rules in the highest numbered override group.The
Tax
objects in the effective rules will be grouped by the priority of the rules. The tax groups are returned as list of tax lists.Parameters: tax_rules (Iterable[TaxRule]) – Tax rules to filter from. These should be ordered desceding by override group and then ascending by priority. Return type: list[list[shoop.core.models.Tax]]
-
class
shoop.default_tax.
AppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.default_tax'¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
label
= 'default_tax'¶
-
provides
= {'admin_module': ['shoop.default_tax.admin_module:TaxRulesAdminModule'], 'tax_module': ['shoop.default_tax.module:DefaultTaxModule']}¶
-
-
class
shoop.front.admin_module.carts.views.
CartListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3ce294a20>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce294048>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce2949e8>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce294c18>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce294748>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce2d5e80>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce2d5a20>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce2d5e48>]¶
-
get_queryset
()[source]¶ Ignore potentially active carts, displaying only those not updated for at least 2 hours.
-
model
¶ alias of
StoredBasket
-
-
class
shoop.front.apps.auth.forms.
EmailAuthenticationForm
(*args, **kwargs)[source]¶ Bases:
django.contrib.auth.forms.AuthenticationForm
-
error_messages
= {'inactive': 'This account is inactive.', 'invalid_login': 'Please enter a correct %(username)s and password. Note that both fields may be case-sensitive. In case of multiple accounts with same email only username can be used to login.'}¶
-
base_fields
= OrderedDict([('username', <django.forms.fields.CharField object at 0x7ff3d476dba8>), ('password', <django.forms.fields.CharField object at 0x7ff3d476ddd8>)])¶
-
declared_fields
= OrderedDict([('username', <django.forms.fields.CharField object at 0x7ff3d476dba8>), ('password', <django.forms.fields.CharField object at 0x7ff3d476ddd8>)])¶
-
media
¶
-
-
class
shoop.front.apps.auth.forms.
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
-
token_generator
= <django.contrib.auth.tokens.PasswordResetTokenGenerator object>¶
-
subject_template_name
= ('shoop/user/recover_password_mail_subject.jinja',)¶
-
email_template_name
= 'shoop/user/recover_password_mail_content.jinja'¶
-
from_email
= None¶
-
base_fields
= OrderedDict([('username', <django.forms.fields.CharField object at 0x7ff3d407aeb8>), ('email', <django.forms.fields.EmailField object at 0x7ff3d40810b8>)])¶
-
declared_fields
= OrderedDict([('username', <django.forms.fields.CharField object at 0x7ff3d407aeb8>), ('email', <django.forms.fields.EmailField object at 0x7ff3d40810b8>)])¶
-
media
¶
-
-
class
shoop.front.apps.auth.views.
LoginView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/user/login.jinja'¶
-
form_class
¶ alias of
EmailAuthenticationForm
-
-
class
shoop.front.apps.auth.views.
LogoutView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/user/logout.jinja'¶
-
-
class
shoop.front.apps.auth.views.
RecoverPasswordView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/user/recover_password.jinja'¶
-
form_class
¶ alias of
RecoverPasswordForm
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.front.apps.auth.views.
RecoverPasswordConfirmView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/user/recover_password_confirm.jinja'¶
-
form_class
¶ alias of
SetPasswordForm
-
token_generator
= <django.contrib.auth.tokens.PasswordResetTokenGenerator object>¶
-
success_url
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.front.apps.auth.views.
RecoverPasswordSentView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/user/recover_password_sent.jinja'¶
-
-
class
shoop.front.apps.auth.views.
RecoverPasswordCompleteView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/user/recover_password_complete.jinja'¶
-
-
class
shoop.front.apps.customer_information.forms.
PersonContactForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
PersonContact
-
fields
= ('first_name', 'last_name', 'phone', 'email', 'gender', 'marketing_permission')¶
-
-
PersonContactForm.
base_fields
= OrderedDict([('first_name', <django.forms.fields.CharField object at 0x7ff3d408c2e8>), ('last_name', <django.forms.fields.CharField object at 0x7ff3d408c400>), ('phone', <django.forms.fields.CharField object at 0x7ff3d4081e48>), ('email', <django.forms.fields.EmailField object at 0x7ff3d408c048>), ('gender', <enumfields.forms.EnumChoiceField object at 0x7ff3d408c1d0>), ('marketing_permission', <django.forms.fields.BooleanField object at 0x7ff3d4081d68>)])¶
-
PersonContactForm.
declared_fields
= OrderedDict()¶
-
PersonContactForm.
media
¶
-
class
-
class
shoop.front.apps.customer_information.forms.
AddressForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
MutableAddress
-
fields
= ('name', 'phone', 'email', 'street', 'street2', 'postal_code', 'city', 'region', 'country')¶
-
-
AddressForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d408c6a0>), ('phone', <django.forms.fields.CharField object at 0x7ff3d408c828>), ('email', <django.forms.fields.EmailField object at 0x7ff3d408c9e8>), ('street', <django.forms.fields.CharField object at 0x7ff3d408cb38>), ('street2', <django.forms.fields.CharField object at 0x7ff3d408ccc0>), ('postal_code', <django.forms.fields.CharField object at 0x7ff3d408ce48>), ('city', <django.forms.fields.CharField object at 0x7ff3d408cfd0>), ('region', <django.forms.fields.CharField object at 0x7ff3d4091198>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7ff3d4091390>)])¶
-
AddressForm.
declared_fields
= OrderedDict()¶
-
AddressForm.
media
¶
-
class
-
class
shoop.front.apps.customer_information.forms.
CompanyContactForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
CompanyContact
-
fields
= ('name', 'tax_number', 'phone', 'email', 'marketing_permission')¶
-
-
CompanyContactForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d40917f0>), ('tax_number', <django.forms.fields.CharField object at 0x7ff3d4091b00>), ('phone', <django.forms.fields.CharField object at 0x7ff3d4091668>), ('email', <django.forms.fields.EmailField object at 0x7ff3d40919b0>), ('marketing_permission', <django.forms.fields.BooleanField object at 0x7ff3d4091588>)])¶
-
CompanyContactForm.
declared_fields
= OrderedDict()¶
-
CompanyContactForm.
media
¶
-
class
-
class
shoop.front.apps.customer_information.views.
CustomerEditView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/customer_information/edit_customer.jinja'¶
-
get_form
(form_class=None)¶
-
-
class
shoop.front.apps.customer_information.views.
CompanyEditView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/customer_information/edit_company.jinja'¶
-
get_form
(form_class=None)¶
-
-
class
shoop.front.apps.customer_information.
AppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.front.apps.customer_information'¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
label
= 'shoop_front.customer_information'¶
-
provides
= {'front_urls': ['shoop.front.apps.customer_information.urls:urlpatterns']}¶
-
-
class
shoop.front.apps.personal_order_history.views.
OrderViewMixin
[source]¶ Bases:
object
-
model
¶ alias of
Order
-
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/personal_order_history/order_list.jinja'¶
-
context_object_name
= 'orders'¶
-
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/personal_order_history/order_detail.jinja'¶
-
context_object_name
= 'order'¶
-
-
class
shoop.front.apps.personal_order_history.
AppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.front.apps.personal_order_history'¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
label
= 'shoop_front.personal_order_history'¶
-
provides
= {'front_urls': ['shoop.front.apps.personal_order_history.urls:urlpatterns']}¶
-
-
shoop.front.apps.registration.settings.
SHOOP_REGISTRATION_REQUIRES_ACTIVATION
= True¶ Require email-based activation for users?
This corresponds to using the
default
orsimple
django-registration
backends.
-
class
shoop.front.apps.registration.views.
RegistrationViewMixin
[source]¶ Bases:
object
-
template_name
= 'shoop/registration/register.jinja'¶
-
-
class
shoop.front.apps.registration.views.
RegistrationNoActivationView
(**kwargs)[source]¶ Bases:
shoop.front.apps.registration.views.RegistrationViewMixin
,registration.backends.simple.views.RegistrationView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
shoop.front.apps.registration.views.
RegistrationWithActivationView
(**kwargs)[source]¶ Bases:
shoop.front.apps.registration.views.RegistrationViewMixin
,registration.backends.default.views.RegistrationView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
class
shoop.front.apps.registration.views.
RegistrationView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
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
-
name
= 'shoop.front.apps.registration'¶
-
verbose_name
= 'Shoop Frontend - User Registration'¶
-
label
= 'shoop_front.registration'¶
-
required_installed_apps
= {'registration': 'django-registration-redux is required for user registration and activation'}¶
-
provides
= {'front_urls': ['shoop.front.apps.registration.urls:urlpatterns']}¶
-
-
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_order_notification.
SimpleOrderNotificationAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.front.apps.simple_order_notification'¶
-
verbose_name
= 'Shoop Frontend - Simple Order Notification'¶
-
label
= 'shoop_front.simple_order_notification'¶
-
provides
= {'admin_module': ['shoop.front.apps.simple_order_notification.admin_module:SimpleOrderNotificationModule']}¶
-
-
class
shoop.front.apps.simple_search.template_helpers.
TemplateHelpers
[source]¶ Bases:
object
-
name
= 'simple_search'¶
-
get_search_form
(context, template_name='shoop/simple_search/search_form.jinja')[source]¶ Get a product search form, usable e.g. for navigation bars. The
q
request parameter is used by default to pre-fill the search query field. The name of the template rendered can be overridden with thetemplate_name
parameter.Parameters: - context (jinja2.runtime.Context) – Template context
- template_name (str) – Template file name
-
-
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 0x7ff3d40a0eb8>), ('sort', <django.forms.fields.CharField object at 0x7ff3d40a7588>)])¶
-
declared_fields
= OrderedDict([('q', <django.forms.fields.CharField object at 0x7ff3d40a0eb8>), ('sort', <django.forms.fields.CharField object at 0x7ff3d40a7588>)])¶
-
media
¶
-
-
class
shoop.front.apps.simple_search.views.
SearchView
(**kwargs)[source]¶ Bases:
django.views.generic.list.ListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
SearchForm
-
template_name
= 'shoop/simple_search/search.jinja'¶
-
model
¶ alias of
Product
-
context_object_name
= 'products'¶
-
-
class
shoop.front.apps.simple_search.
SimpleSearchAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.front.apps.simple_search'¶
-
verbose_name
= 'Shoop Frontend - Simple Search'¶
-
label
= 'shoop_front.simple_search'¶
-
provides
= {'front_urls': ['shoop.front.apps.simple_search.urls:urlpatterns'], 'front_template_helper_namespace': ['shoop.front.apps.simple_search.template_helpers:TemplateHelpers']}¶
-
-
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/shuup/checkouts/stable/doc/../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
-
preprocess_kwargs
(command, kwargs)[source]¶ Preprocess kwargs before they are passed to the given
command
handler. Useful for subclassing. Must return the newkwargs
, 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
-
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.
-
-
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.
- product_id – product ID to add (or if
-
shoop.front.basket.commands.
handle_add_var
(request, basket, product_id, quantity=1, **kwargs)[source]¶ Handle adding a complex variable product into the basket by resolving the combination variables. This actually uses
kwargs
, expectingvar_XXX=YYY
to exist there, whereXXX
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_del
(request, basket, line_id, **kwargs)[source]¶ Handle deleting a distinct order line from the basket given its unique line ID.
Parameters: line_id – The line ID to delete. Returns:
-
class
shoop.front.basket.objects.
BasketLine
(source=None, **kwargs)[source]¶ Bases:
shoop.core.order_creator.SourceLine
-
shop_product
¶ ShopProduct object of this line.
Return type: shoop.core.models.ShopProduct
-
type
¶
-
can_delete
¶
-
can_change_quantity
¶
-
-
class
shoop.front.basket.objects.
BaseBasket
(request, basket_name='basket')[source]¶ Bases:
shoop.core.order_creator.OrderSource
-
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.
-
finalize
()[source]¶ Mark the basket as “completed” (i.e. an order is created/a conversion made).
This will also clear the basket’s data.
-
add_product
(supplier, shop, product, quantity, force_new_line=False, extra=None, parent_line=None)[source]¶
-
orderable
¶
-
-
class
shoop.front.basket.order_creator.
BasketOrderCreator
(request=None)[source]¶ Bases:
shoop.core.order_creator.OrderCreator
Initialize order creator.
Parameters: request (django.http.HttpRequest|None) – Optional request object for backward compatibility. Passing non-None value is DEPRECATED.
-
class
shoop.front.basket.storage.
BasketStorage
[source]¶ Bases:
object
-
load
(basket)[source]¶ Load the given basket’s data dictionary from the storage.
Return type: dict Raises: BasketCompatibilityError
if basket loaded from the storage is not compatible with the requested basket.
-
-
class
shoop.front.basket.storage.
DictStoredBasket
(id, shop_id, currency, prices_include_tax, data)[source]¶ Bases:
object
-
shoop.front.basket.storage.
get_storage
()[source]¶ Retrieve a basket storage object.
Returns: A basket storage object Return type: BasketStorage
-
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. (Seeupdate_quantity
ordelete_line
for examples.)
-
-
shoop.front.basket.
get_basket_command_dispatcher
(request)[source]¶ Return type: shoop.front.basket.command_dispatcher.BasketCommandDispatcher
-
shoop.front.basket.
get_basket
(request)[source]¶ Return type: shoop.front.basket.objects.BaseBasket
-
class
shoop.front.checkout.addresses.
AddressForm
(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
MutableAddress
-
fields
= ('name', 'phone', 'email', 'street', 'street2', 'postal_code', 'city', 'region', 'country')¶
-
-
AddressForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3ceaaac18>), ('phone', <django.forms.fields.CharField object at 0x7ff3ceb5d588>), ('email', <django.forms.fields.EmailField object at 0x7ff3cee619e8>), ('street', <django.forms.fields.CharField object at 0x7ff3cf2b42b0>), ('street2', <django.forms.fields.CharField object at 0x7ff3d0c52828>), ('postal_code', <django.forms.fields.CharField object at 0x7ff3cead65f8>), ('city', <django.forms.fields.CharField object at 0x7ff3cedd69b0>), ('region', <django.forms.fields.CharField object at 0x7ff3cea004a8>), ('country', <django_countries.fields.LazyTypedChoiceField object at 0x7ff3ce541e10>)])¶
-
AddressForm.
declared_fields
= OrderedDict()¶
-
AddressForm.
media
¶
-
class
-
class
shoop.front.checkout.addresses.
CompanyForm
(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:
shoop.front.checkout._mixins.TaxNumberCleanMixin
,django.forms.models.ModelForm
-
company_name_field
= 'name'¶
-
CompanyForm.
base_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3ceae35c0>), ('tax_number', <django.forms.fields.CharField object at 0x7ff3cedeb630>)])¶
-
CompanyForm.
declared_fields
= OrderedDict()¶
-
CompanyForm.
media
¶
-
-
class
shoop.front.checkout.addresses.
AddressesPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.CheckoutPhaseViewMixin
,django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'addresses'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/front/checkout/addresses.jinja'¶
-
address_kinds
= ('shipping', 'billing')¶
-
address_form_class
¶ alias of
AddressForm
-
address_form_classes
= {}¶
-
company_form_class
¶ alias of
CompanyForm
-
get_form
(form_class=None)¶
-
-
class
shoop.front.checkout.confirm.
ConfirmForm
(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([('accept_terms', <django.forms.fields.BooleanField object at 0x7ff3ce787e10>), ('marketing', <django.forms.fields.BooleanField object at 0x7ff3ce787cc0>), ('comment', <django.forms.fields.CharField object at 0x7ff3ce837cc0>)])¶
-
declared_fields
= OrderedDict([('accept_terms', <django.forms.fields.BooleanField object at 0x7ff3ce787e10>), ('marketing', <django.forms.fields.BooleanField object at 0x7ff3ce787cc0>), ('comment', <django.forms.fields.CharField object at 0x7ff3ce837cc0>)])¶
-
media
¶
-
-
class
shoop.front.checkout.confirm.
ConfirmPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.CheckoutPhaseViewMixin
,django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'confirm'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/front/checkout/confirm.jinja'¶
-
form_class
¶ alias of
ConfirmForm
-
-
class
shoop.front.checkout.empty.
EmptyPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.CheckoutPhaseViewMixin
,django.views.generic.base.TemplateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'empty'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/front/checkout/empty.jinja'¶
-
-
class
shoop.front.checkout.methods.
MethodWidget
(attrs=None, choices=())[source]¶ Bases:
django.forms.widgets.Widget
-
media
¶
-
-
class
shoop.front.checkout.methods.
MethodChoiceIterator
(field)[source]¶ Bases:
django.forms.models.ModelChoiceIterator
-
class
shoop.front.checkout.methods.
MethodsForm
(*args, **kwargs)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('shipping_method', <django.forms.models.ModelChoiceField object at 0x7ff3ce4327b8>), ('payment_method', <django.forms.models.ModelChoiceField object at 0x7ff3ce369898>)])¶
-
declared_fields
= OrderedDict([('shipping_method', <django.forms.models.ModelChoiceField object at 0x7ff3ce4327b8>), ('payment_method', <django.forms.models.ModelChoiceField object at 0x7ff3ce369898>)])¶
-
media
¶
-
-
class
shoop.front.checkout.methods.
MethodsPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.CheckoutPhaseViewMixin
,django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'methods'¶
-
title
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/front/checkout/methods.jinja'¶
-
form_class
¶ alias of
MethodsForm
-
-
class
shoop.front.checkout.methods.
ShippingMethodPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.methods._MethodDependentCheckoutPhase
,django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'shipping'¶
-
-
class
shoop.front.checkout.methods.
PaymentMethodPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.methods._MethodDependentCheckoutPhase
,django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'payment'¶
-
-
class
shoop.front.checkout.single_page.
OrderForm
(*args, **kwargs)[source]¶ Bases:
shoop.front.checkout._mixins.TaxNumberCleanMixin
,django.forms.forms.Form
-
base_fields
= OrderedDict([('company_name', <django.forms.fields.CharField object at 0x7ff3d0add080>), ('tax_number', <django.forms.fields.CharField object at 0x7ff3d0addd68>), ('shipping_method', <shoop.utils.fields.RelaxedModelChoiceField object at 0x7ff3d0da16a0>), ('payment_method', <shoop.utils.fields.RelaxedModelChoiceField object at 0x7ff3d0da1fd0>), ('accept_terms', <django.forms.fields.BooleanField object at 0x7ff3d0da1b70>), ('marketing', <django.forms.fields.BooleanField object at 0x7ff3cf0af400>), ('comment', <django.forms.fields.CharField object at 0x7ff3d0da10b8>)])¶
-
declared_fields
= OrderedDict([('company_name', <django.forms.fields.CharField object at 0x7ff3d0add080>), ('tax_number', <django.forms.fields.CharField object at 0x7ff3d0addd68>), ('shipping_method', <shoop.utils.fields.RelaxedModelChoiceField object at 0x7ff3d0da16a0>), ('payment_method', <shoop.utils.fields.RelaxedModelChoiceField object at 0x7ff3d0da1fd0>), ('accept_terms', <django.forms.fields.BooleanField object at 0x7ff3d0da1b70>), ('marketing', <django.forms.fields.BooleanField object at 0x7ff3cf0af400>), ('comment', <django.forms.fields.CharField object at 0x7ff3d0da10b8>)])¶
-
media
¶
-
-
class
shoop.front.checkout.single_page.
SingleCheckoutPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.CheckoutPhaseViewMixin
,django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'checkout'¶
-
final
= True¶
-
template_name
= 'shoop/front/checkout/single_phase.jinja'¶
-
billing_address_form_class
¶ alias of
AddressForm
-
shipping_address_form_class
¶ alias of
AddressForm
-
get_form
(form_class=None)¶
-
-
class
shoop.front.checkout.
BasicServiceCheckoutPhaseProvider
¶ Bases:
shoop.front.checkout.ServiceCheckoutPhaseProvider
Helper for implementing basic ServiceCheckoutPhaseProvider.
This helper should be useful for most cases, where one only has to provide a checkout phase for certain service provider type just by initializing some predefined class.
-
get_checkout_phase
(checkout_process, service)[source]¶ Get checkout phase for given service.
Return type: shoop.front.checkout.CheckoutPhaseViewMixin|None
-
phase_class
= None¶
-
service_provider_class
= None¶
-
-
class
shoop.front.checkout.
CheckoutPhaseViewMixin
¶ Bases:
object
-
checkout_process
= None¶
-
final
= False¶
-
identifier
= None¶
-
next_phase
= None¶
-
phases
= ()¶
-
previous_phase
= None¶
-
request
= None¶
-
storage
¶
-
title
= None¶
-
-
class
shoop.front.checkout.
CheckoutProcess
(phase_specs, phase_kwargs)¶ Bases:
object
-
add_phase_attributes
(target_phase, current_phase=None)[source]¶ Add phase instance attributes (previous, next, etc) to the given target phase, using the optional
current_phase
as the current phase for previous and next.This is exposed as a public API for the benefit of phases that need to do sub-phase initialization and dispatching, such as method phases.
-
complete
()[source]¶ To be called from a phase (
self.checkout_process.complete()
) when the checkout process is complete.
-
phases
¶ Return type: Iterable[CheckoutPhaseViewMixin]
-
-
class
shoop.front.models.stored_basket.
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:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
shop
¶
-
customer
¶
-
orderer
¶
-
creator
¶
-
data
¶ A placeholder class that provides a way to set the attribute on the model.
-
taxful_total_price
¶
-
taxless_total_price
¶
-
products
¶
-
exception
DoesNotExist
¶
-
exception
StoredBasket.
MultipleObjectsReturned
¶
-
StoredBasket.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
StoredBasket.
get_next_by_updated_on
(*moreargs, **morekwargs)¶
-
StoredBasket.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
StoredBasket.
get_previous_by_updated_on
(*moreargs, **morekwargs)¶
-
StoredBasket.
objects
= <django.db.models.manager.Manager object>¶
-
-
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:
shoop.utils.properties.MoneyPropped
,django.db.models.base.Model
-
exception
DoesNotExist
¶
-
exception
StoredBasket.
MultipleObjectsReturned
¶
-
StoredBasket.
creator
¶
-
StoredBasket.
customer
¶
-
StoredBasket.
data
¶ A placeholder class that provides a way to set the attribute on the model.
-
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_visible_products
(context, n_products, ordering=None, filter_dict=None, orderable_only=True)[source]¶ Parameters: Return type: list[shoop.core.models.Product]
-
shoop.front.template_helpers.general.
get_best_selling_products
(context, n_products=12, cutoff_days=30, orderable_only=True)[source]¶
-
shoop.front.template_helpers.general.
get_newest_products
(context, n_products=6, orderable_only=True)[source]¶
-
shoop.front.template_helpers.product.
get_product_cross_sells
(context, product, relation_type=<ProductCrossSellType.RELATED: 2>, count=4, orderable_only=True)[source]¶
-
shoop.front.template_helpers.product.
map_relation_type
(relation_type)[source]¶ Map relation type to enum value.
Return type: ProductCrossSellType Raises: LookupError
if unknown string is given
-
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_ordered_with
(prod, count=20, request=None, language=None)[source]¶
-
class
shoop.front.views.basket.
DefaultBasketView
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/front/basket/default_basket.jinja'¶
-
-
class
shoop.front.views.basket.
BasketView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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 0x7ff3d40d1748>), ('manufacturers', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d40d1be0>)])¶
-
declared_fields
= OrderedDict([('sort', <django.forms.fields.CharField object at 0x7ff3d40d1748>), ('manufacturers', <django.forms.models.ModelMultipleChoiceField object at 0x7ff3d40d1be0>)])¶
-
media
¶
-
-
class
shoop.front.views.category.
CategoryView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/front/product/category.jinja'¶
-
model
¶ alias of
Category
-
template_object_name
= 'category'¶
-
-
class
shoop.front.views.order.
OrderCompleteView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/front/order/complete.jinja'¶
-
model
¶ alias of
Order
-
context_object_name
= 'order'¶
-
-
class
shoop.front.views.order.
OrderRequiresVerificationView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/front/order/requires_verification.jinja'¶
-
model
¶ alias of
Order
-
-
class
shoop.front.views.payment.
ProcessPaymentView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Order
-
context_object_name
= 'order'¶
-
-
class
shoop.front.views.product.
ProductDetailView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/front/product/detail.jinja'¶
-
model
¶ alias of
Product
-
context_object_name
= 'product'¶
-
-
shoop.front.error_handling.
install_error_handlers
()[source]¶ Install custom error handlers.
Error handlers to be added are for errors 400, 403, 404, and 500.
Error handlers will be injected only if: *
settings.SHOOP_FRONT_INSTALL_ERROR_HANDLERS
isTrue
*settings.ROOT_URLCONF
doesn’t already contain the handler
-
shoop.front.middleware.
ProblemMiddleware
¶ alias of
ExceptionMiddleware
-
class
shoop.front.middleware.
ShoopFrontMiddleware
[source]¶ Bases:
object
Handle Shoop specific tasks for each request and response.
Set request attributes that rest of the Shoop front-end rely on.
Set Django’s timezone according to personal preferences (i.e. request.person.timezone).
Todo
Fallback to shop timezone?
Make sure that basket is saved before response is returned to the browser.
Attributes set for requests:
request.shop
: Currently active Shop.
Todo
Define better
request.person
: PersonContact
of currently logged in user orAnonymousContact
if there is no logged in user.request.customer
: - Customer contact used when creating Orders. This can be same
as
request.person
, but for example in B2B shops this is usually aCompanyContact
whereasrequest.person
is aPersonContact
. request.basket
: - Shopping basket in use.
shoop.core.models.Shop
shoop.core.models.Contact
shoop.core.models.Contact
shoop.front.basket.objects.BaseBasket
-
class
shoop.front.notify_events.
OrderReceived
(**variable_values)[source]¶ Bases:
shoop.notify.base.Event
-
identifier
= 'order_received'¶
-
bindings
= {}¶
-
name
= 'Order Received'¶
-
variables
= {'order': <shoop.notify.base.Variable object at 0x7ff3ce34a6a0>, 'customer_phone': <shoop.notify.base.Variable object at 0x7ff3ce34a550>, 'language': <shoop.notify.base.Variable object at 0x7ff3ce34a5c0>, 'customer_email': <shoop.notify.base.Variable object at 0x7ff3ce34afd0>}¶
-
-
shoop.front.settings.
SHOOP_BASKET_ORDER_CREATOR_SPEC
= 'shoop.front.basket.order_creator:BasketOrderCreator'¶ Spec string for the class used for creating Order from a Basket.
This is the easiest way to customize the order creation process without having to override a single URL or touch the
shoop.front
code.
-
shoop.front.settings.
SHOOP_BASKET_VIEW_SPEC
= 'shoop.front.views.basket:DefaultBasketView'¶ Spec string for the Django CBV (or an API-compliant class) for the basket view.
This view deals with
/basket/
.
-
shoop.front.settings.
SHOOP_BASKET_COMMAND_DISPATCHER_SPEC
= 'shoop.front.basket.command_dispatcher:BasketCommandDispatcher'¶ Spec string for the command dispatcher used when products are added/deleted/etc. from the basket.
This view deals with commands
POST``ed to ``/basket/
.
-
shoop.front.settings.
SHOOP_BASKET_UPDATE_METHODS_SPEC
= 'shoop.front.basket.update_methods:BasketUpdateMethods'¶ Spec string for the update method dispatcher used when the basket is updated (usually on the basket page).
-
shoop.front.settings.
SHOOP_BASKET_CLASS_SPEC
= 'shoop.front.basket.objects:BaseBasket'¶ Spec string for the basket class used in the frontend.
This is used to customize the behavior of the basket for a given installation, for instance to modify prices of products based on certain conditions, etc.
-
shoop.front.settings.
SHOOP_BASKET_STORAGE_CLASS_SPEC
= 'shoop.front.basket.storage:DatabaseBasketStorage'¶ The spec string defining which basket storage class to use for the frontend.
Basket storages are responsible for persisting visitor basket state, whether in the database (DatabaseBasketStorage) or directly in the session (DirectSessionBasketStorage). Custom storage backends could use caches, flat files, etc. if required.
-
shoop.front.settings.
SHOOP_CHECKOUT_VIEW_SPEC
= 'shoop.front.views.checkout:DefaultCheckoutView'¶ Spec string for the Django CBV (or an API-compliant class) for the checkout view.
This is used to customize the behavior of the checkout process; most likely to switch in a view with a different
phase_specs
.
-
shoop.front.settings.
SHOOP_FRONT_INSTALL_ERROR_HANDLERS
= True¶ Whether Shoop uses its own error handlers.
If this value is set to
False
django defaults are used or the ones specified insettings.ROOT_URLCONF
file.Setting this to
True
won’t override handlers specified insettings.ROOT_URLCONF
.Handled error cases are: 400, 403, 404, and 500
-
shoop.front.settings.
SHOOP_FRONT_ADDRESS_FIELD_PROPERTIES
= {}¶ A dictionary defining properties to override the default field properties of the checkout address form. Should map the field name (as a string) to a dictionary containing the overridding Django form field properties, as in the following example which makes the postal code a required field:
- SHOOP_FRONT_ADDRESS_FIELD_PROPERTIES = {
- “postal_code”: {“required”: True}
}
It should be noted, however, that overriding some settings (such as making a required field non-required) could create other validation issues.
-
class
shoop.front.
ShoopFrontAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.front'¶
-
verbose_name
= 'Shoop Frontend'¶
-
label
= 'shoop_front'¶
-
provides
= {'notify_event': ['shoop.front.notify_events:OrderReceived'], 'admin_module': ['shoop.front.admin_module.CartAdminModule']}¶
-
-
class
shoop.guide.admin_module.
GuideAdminModule
[source]¶ Bases:
shoop.admin.base.AdminModule
-
shoop.guide.settings.
SHOOP_GUIDE_API_URL
= 'https://readthedocs.org/api/v2/search/?project=shoop-guide&version=latest&'¶ ReadtheDocs API URL
URL for fetching search results via ReadtheDocs API.
-
shoop.guide.settings.
SHOOP_GUIDE_LINK_URL
= 'http://shoop-guide.readthedocs.io/en/latest/search.html?check_keywords=yes&area=default&'¶ ReadtheDocs link URL
URL for manually linking search query link. Query parameters are added to end of URL when constructing link.
-
shoop.guide.settings.
SHOOP_GUIDE_FETCH_RESULTS
= True¶ Whether or not to fetch search results from ReadtheDocs
If true, fetch results via the ReadtheDocs API, otherwise only display a link to RTD search page.
-
shoop.guide.settings.
SHOOP_GUIDE_TIMEOUT_LIMIT
= 2¶ Timeout limit for fetching search results
Time limit in seconds before a search result request should timeout, so as not to block search results in case of slow response.
-
class
shoop.notify.actions.email.
SendEmail
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
identifier
= 'send_email'¶
-
template_use
= <TemplateUse.MULTILINGUAL: 2>¶
-
template_fields
= {'subject': <django.forms.fields.CharField object at 0x7ff3cf44d908>, 'body': <django.forms.fields.CharField object at 0x7ff3d1133320>}¶
-
execute
(context)[source]¶ Parameters: context (shoop.notify.script.Context) – Script Context
-
bindings
= {'send_identifier': <shoop.notify.base.Binding object at 0x7ff3d1d2e5f8>, 'recipient': <shoop.notify.base.Binding object at 0x7ff3d1d2eb38>, 'language': <shoop.notify.base.Binding object at 0x7ff3d1d2e518>, 'fallback_language': <shoop.notify.base.Binding object at 0x7ff3d1d2e8d0>}¶
-
name
= 'Send Email'¶
-
variables
= {}¶
-
-
class
shoop.notify.actions.notification.
AddNotification
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
identifier
= 'add_notification'¶
-
bindings
= {'message_identifier': <shoop.notify.base.Binding object at 0x7ff3d1619710>, 'message': <shoop.notify.base.TemplatedBinding object at 0x7ff3cfa1f860>, 'priority': <shoop.notify.base.Binding object at 0x7ff3d1d2e5c0>, 'url': <shoop.notify.base.Binding object at 0x7ff3d1619cc0>, 'recipient_type': <shoop.notify.base.Binding object at 0x7ff3d131b908>, 'recipient': <shoop.notify.base.Binding object at 0x7ff3d1d2e908>}¶
-
name
= 'Add Notification'¶
-
variables
= {}¶
-
-
class
shoop.notify.actions.order.
AddOrderLogEntry
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
identifier
= 'add_order_log_entry'¶
-
bindings
= {'order': <shoop.notify.base.Binding object at 0x7ff3ce814ef0>, 'message_identifier': <shoop.notify.base.Binding object at 0x7ff3d0b15860>, 'message': <shoop.notify.base.Binding object at 0x7ff3d1619240>}¶
-
name
= 'Add Order Log Entry'¶
-
variables
= {}¶
-
-
class
shoop.notify.actions.
AddNotification
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Action
-
bindings
= {'message_identifier': <shoop.notify.base.Binding object at 0x7ff3d1619710>, 'message': <shoop.notify.base.TemplatedBinding object at 0x7ff3cfa1f860>, 'priority': <shoop.notify.base.Binding object at 0x7ff3d1d2e5c0>, 'url': <shoop.notify.base.Binding object at 0x7ff3d1619cc0>, 'recipient_type': <shoop.notify.base.Binding object at 0x7ff3d131b908>, 'recipient': <shoop.notify.base.Binding object at 0x7ff3d1d2e908>}¶
-
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 0x7ff3ce814ef0>, 'message_identifier': <shoop.notify.base.Binding object at 0x7ff3d0b15860>, 'message': <shoop.notify.base.Binding object at 0x7ff3d1619240>}¶
-
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
= {'send_identifier': <shoop.notify.base.Binding object at 0x7ff3d1d2e5f8>, 'recipient': <shoop.notify.base.Binding object at 0x7ff3d1d2eb38>, 'language': <shoop.notify.base.Binding object at 0x7ff3d1d2e518>, 'fallback_language': <shoop.notify.base.Binding object at 0x7ff3d1d2e8d0>}¶
-
execute
(context)[source]¶ Parameters: context (shoop.notify.script.Context) – Script Context
-
identifier
= 'send_email'¶
-
name
= 'Send Email'¶
-
template_fields
= {'subject': <django.forms.fields.CharField object at 0x7ff3cf44d908>, 'body': <django.forms.fields.CharField object at 0x7ff3d1133320>}¶
-
template_use
= <TemplateUse.MULTILINGUAL: 2>¶
-
variables
= {}¶
-
-
class
shoop.notify.admin_module.views.edit.
ScriptEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Script
-
form_class
¶ alias of
ScriptForm
-
template_name
= 'notify/admin/edit_script.jinja'¶
-
context_object_name
= 'script'¶
-
-
class
shoop.notify.admin_module.views.editor.
ScriptAPI
(request, script)[source]¶ Bases:
object
Parameters: - request (django.http.HttpRequest) – Request
- script (shoop.notify.models.Script) – Script
-
class
shoop.notify.admin_module.views.editor.
EditScriptContentView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'notify/admin/script_content_editor.jinja'¶
-
model
¶ alias of
Script
-
context_object_name
= 'script'¶
-
-
class
shoop.notify.admin_module.views.list.
ScriptListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Script
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3ce82c278>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce369470>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce82c0b8>]¶
-
-
class
shoop.notify.admin_module.views.
ScriptEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
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
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3ce82c278>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce369470>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce82c0b8>]¶
-
model
¶ alias of
Script
-
-
class
shoop.notify.admin_module.forms.
ScriptForm
(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
Script
-
fields
= ('event_identifier', 'name', 'enabled')¶
-
-
ScriptForm.
base_fields
= OrderedDict([('event_identifier', <django.forms.fields.ChoiceField object at 0x7ff3d1c2a198>), ('name', <django.forms.fields.CharField object at 0x7ff3d0b70f60>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3d029af60>)])¶
-
ScriptForm.
declared_fields
= OrderedDict([('event_identifier', <django.forms.fields.ChoiceField object at 0x7ff3d1c2a198>), ('name', <django.forms.fields.CharField object at 0x7ff3d0b70f60>), ('enabled', <django.forms.fields.BooleanField object at 0x7ff3d029af60>)])¶
-
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.
NonEmpty
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Condition
-
identifier
= 'non_empty'¶
-
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
bindings
= {'v': <shoop.notify.base.Binding object at 0x7ff3d10e4390>}¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.simple.
Empty
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Condition
-
identifier
= 'empty'¶
-
description
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
bindings
= {'v': <shoop.notify.base.Binding object at 0x7ff3d16f8940>}¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.simple.
BaseEqual
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Condition
-
identifier_suffix
= 'equal'¶
-
bindings
= {}¶
-
identifier
= 'base_equal'¶
-
name
= 'Base Equal'¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.
BooleanEqual
(data, validate=True)¶ Bases:
shoop.notify.conditions.simple.BaseEqual
-
bindings
= {'v1': <shoop.notify.base.Binding object at 0x7ff3d154d358>, 'v2': <shoop.notify.base.Binding object at 0x7ff3d1b33c18>}¶
-
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 0x7ff3d16f8940>}¶
-
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
= {'v1': <shoop.notify.base.Binding object at 0x7ff3d0b42f98>, 'v2': <shoop.notify.base.Binding object at 0x7ff3d1b331d0>}¶
-
identifier
= 'integer_equal'¶
-
name
= 'Integer Equal'¶
-
variables
= {}¶
-
-
class
shoop.notify.conditions.
LanguageEqual
(data, validate=True)¶ Bases:
shoop.notify.conditions.simple.CaseInsensitiveStringEqual
-
bindings
= {'v1': <shoop.notify.base.Binding object at 0x7ff3d0b422b0>, 'v2': <shoop.notify.base.Binding object at 0x7ff3d0b428d0>}¶
-
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 0x7ff3d10e4390>}¶
-
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
= {'v1': <shoop.notify.base.Binding object at 0x7ff3d0b424e0>, 'v2': <shoop.notify.base.Binding object at 0x7ff3d0b42898>}¶
-
identifier
= 'text_equal'¶
-
name
= 'Text Equal'¶
-
variables
= {}¶
-
-
class
shoop.notify.models.notification.
NotificationManager
[source]¶ Bases:
django.db.models.manager.Manager
-
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.
-
recipient_type
¶ A placeholder class that provides a way to set the attribute on the model.
-
recipient
¶
-
priority
¶ A placeholder class that provides a way to set the attribute on the model.
-
marked_read_by
¶
-
objects
= <shoop.notify.models.notification.NotificationManager object>¶
-
is_read
¶
-
data
¶
-
exception
DoesNotExist
¶
-
exception
Notification.
MultipleObjectsReturned
¶
-
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.
url
¶
-
-
class
shoop.notify.models.script.
Script
(id, event_identifier, identifier, created_on, name, enabled, _step_data)[source]¶ Bases:
django.db.models.base.Model
-
event_class
¶
-
execute
(context)[source]¶ Execute the script in the given context.
Parameters: context (shoop.notify.script.Context) – Script context
-
exception
DoesNotExist
¶
-
exception
Script.
MultipleObjectsReturned
¶
-
Script.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
Script.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
Script.
objects
= <django.db.models.manager.Manager object>¶
-
-
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.
Variable
(name, type=<class 'shoop.notify.typology.Type'>, required=True, help_text='')[source]¶ Bases:
object
-
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.
TemplatedBinding
(*args, **kwargs)[source]¶ Bases:
shoop.notify.base.Binding
-
class
shoop.notify.base.
Base
[source]¶ Bases:
object
-
identifier
= None¶
-
name
= None¶
-
description
= None¶
-
variables
= {}¶
-
bindings
= {}¶
-
provide_category
= None¶
-
-
class
shoop.notify.base.
Event
(**variable_values)[source]¶ Bases:
shoop.notify.base.Base
-
provide_category
= 'notify_event'¶
-
identifier
= None¶
-
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.
-
log_target
¶
-
bindings
= {}¶
-
variables
= {}¶
-
-
class
shoop.notify.base.
ScriptItem
(data, validate=True)[source]¶ Bases:
shoop.notify.base.Base
-
provide_category
= None¶
-
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]
-
bindings
= {}¶
-
identifier
= 'script_item'¶
-
name
= 'Script Item'¶
-
variables
= {}¶
-
-
class
shoop.notify.base.
Condition
(data, validate=True)[source]¶ Bases:
shoop.notify.base.ScriptItem
-
provide_category
= 'notify_condition'¶
-
bindings
= {}¶
-
identifier
= 'condition'¶
-
name
= 'Condition'¶
-
variables
= {}¶
-
-
class
shoop.notify.base.
Action
(data, validate=True)[source]¶ Bases:
shoop.notify.base.ScriptItem
-
provide_category
= 'notify_action'¶
-
template_use
= <TemplateUse.NONE: 0>¶
-
template_fields
= {}¶
-
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
-
bindings
= {}¶
-
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'¶
-
variables
= {}¶
-
-
class
shoop.notify.enums.
TemplateUse
[source]¶ Bases:
enumfields.enums.Enum
An enumeration.
-
NONE
= <TemplateUse.NONE: 0>¶
-
UNILINGUAL
= <TemplateUse.UNILINGUAL: 1>¶
-
MULTILINGUAL
= <TemplateUse.MULTILINGUAL: 2>¶
-
-
class
shoop.notify.enums.
ConstantUse
[source]¶ Bases:
enumfields.enums.Enum
An enumeration.
-
VARIABLE_ONLY
= <ConstantUse.VARIABLE_ONLY: 1>¶
-
CONSTANT_ONLY
= <ConstantUse.CONSTANT_ONLY: 2>¶
-
VARIABLE_OR_CONSTANT
= <ConstantUse.VARIABLE_OR_CONSTANT: 3>¶
-
-
class
shoop.notify.enums.
StepNext
[source]¶ Bases:
enumfields.enums.Enum
An enumeration.
-
CONTINUE
= <StepNext.CONTINUE: 'continue'>¶
-
STOP
= <StepNext.STOP: 'stop'>¶
-
-
class
shoop.notify.enums.
StepConditionOperator
[source]¶ Bases:
enumfields.enums.Enum
An enumeration.
-
ALL
= <StepConditionOperator.ALL: 'all'>¶
-
ANY
= <StepConditionOperator.ANY: 'any'>¶
-
NONE
= <StepConditionOperator.NONE: 'none'>¶
-
-
class
shoop.notify.script.
Step
(conditions=(), actions=(), next=<StepNext.CONTINUE: 'continue'>, cond_op=<StepConditionOperator.ALL: 'all'>, enabled=True)[source]¶ Bases:
object
-
enabled
¶
-
-
class
shoop.notify.script.
Context
(variables=None)[source]¶ Bases:
object
-
classmethod
from_variables
(**variables)[source]¶ Create Context from variables.
Return type: shoop.notify.script.Context
-
classmethod
from_event
(event)[source]¶ Create Context from event.
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()
.
-
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:
-
log_entry_queryset
¶
-
classmethod
-
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.template.
Template
(context, data)[source]¶ Bases:
object
Parameters: - context (shoop.notify.script.Context) – Script context
- data (dict) – Template data dictionary
-
class
shoop.notify.typology.
Type
[source]¶ Bases:
object
-
name
= None¶
-
identifier
= None¶
-
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
-
-
class
shoop.notify.typology.
Boolean
[source]¶ Bases:
shoop.notify.typology.Type
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'boolean'¶
-
-
class
shoop.notify.typology.
Integer
[source]¶ Bases:
shoop.notify.typology._Number
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'integer'¶
-
-
class
shoop.notify.typology.
Decimal
[source]¶ Bases:
shoop.notify.typology._Number
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'decimal'¶
-
-
class
shoop.notify.typology.
Text
[source]¶ Bases:
shoop.notify.typology._String
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'text'¶
-
-
class
shoop.notify.typology.
Language
[source]¶ Bases:
shoop.notify.typology._String
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'language'¶
-
-
class
shoop.notify.typology.
Email
[source]¶ Bases:
shoop.notify.typology._String
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'email'¶
-
-
class
shoop.notify.typology.
URL
[source]¶ Bases:
shoop.notify.typology._String
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'url'¶
-
-
class
shoop.notify.typology.
Phone
[source]¶ Bases:
shoop.notify.typology._String
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
identifier
= 'phone'¶
-
-
class
shoop.notify.typology.
Model
(model_label)[source]¶ Bases:
shoop.notify.typology.Type
Parameters: model_label (str) – Model label in Django app.Model
format (e.g.shoop.Order
)-
identifier
= 'model'¶
-
name
¶
-
model_label
= None¶
-
get_model
()[source]¶ Return type: django.db.models.Model
-
-
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.notify.
ConstantUse
[source]¶ Bases:
enumfields.enums.Enum
An enumeration.
-
CONSTANT_ONLY
= <ConstantUse.CONSTANT_ONLY: 2>¶
-
VARIABLE_ONLY
= <ConstantUse.VARIABLE_ONLY: 1>¶
-
VARIABLE_OR_CONSTANT
= <ConstantUse.VARIABLE_OR_CONSTANT: 3>¶
-
-
class
shoop.notify.
Event
(**variable_values)[source]¶ Bases:
shoop.notify.base.Base
-
bindings
= {}¶
-
identifier
= None¶
-
log_target
¶
-
log_target_variable
= None¶
-
provide_category
= 'notify_event'¶
-
variables
= {}¶
-
-
class
shoop.order_printouts.admin_module.toolbar.
SimplePrintoutsToolbarButton
(order, **kwargs)[source]¶ Bases:
shoop.admin.toolbar.DropdownActionButton
-
class
shoop.order_printouts.
AppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.order_printouts'¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
label
= 'shoop_order_printouts'¶
-
provides
= {'admin_order_toolbar_button': ['shoop.order_printouts.admin_module.toolbar:SimplePrintoutsToolbarButton'], 'admin_module': ['shoop.order_printouts.admin_module:PrintoutsAdminModule']}¶
-
-
class
shoop.simple_cms.admin_module.views.
PageForm
(**kwargs)[source]¶ Bases:
shoop.utils.multilanguage_model_form.MultiLanguageModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
Page
-
fields
= ['title', 'url', 'content', 'available_from', 'available_to', 'identifier', 'visible_in_menu', 'parent', 'list_children_on_page']¶
-
-
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.
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.
base_fields
= OrderedDict([('title', <django.forms.fields.CharField object at 0x7ff3ce4ac2e8>), ('url', <django.forms.fields.CharField object at 0x7ff3d1965198>), ('content', <django.forms.fields.CharField object at 0x7ff3d1fefc50>), ('available_from', <django.forms.fields.DateTimeField object at 0x7ff3ce99aa20>), ('available_to', <django.forms.fields.DateTimeField object at 0x7ff3cedd5080>), ('identifier', <django.forms.fields.CharField object at 0x7ff3d0bb77b8>), ('visible_in_menu', <django.forms.fields.BooleanField object at 0x7ff3d0d5a198>), ('parent', <mptt.forms.TreeNodeChoiceField object at 0x7ff3cedd3eb8>), ('list_children_on_page', <django.forms.fields.BooleanField object at 0x7ff3d12efbe0>)])¶
-
PageForm.
declared_fields
= OrderedDict([('available_from', <django.forms.fields.DateTimeField object at 0x7ff3ce99aa20>), ('available_to', <django.forms.fields.DateTimeField object at 0x7ff3cedd5080>), ('title', <django.forms.fields.CharField object at 0x7ff3ce4ac2e8>), ('url', <django.forms.fields.CharField object at 0x7ff3d1965198>), ('content', <django.forms.fields.CharField object at 0x7ff3d1fefc50>)])¶
-
PageForm.
media
¶
-
class
-
class
shoop.simple_cms.admin_module.views.
PageEditView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Page
-
template_name
= 'shoop/simple_cms/admin/edit.jinja'¶
-
context_object_name
= 'page'¶
-
add_form_errors_as_messages
= True¶
-
-
class
shoop.simple_cms.admin_module.views.
PageListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Page
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d0bb7fd0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d25e70f0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d0c9ae48>, <shoop.admin.utils.picotable.Column object at 0x7ff3cedd3ac8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d02e74a8>]¶
-
-
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.
Page
(id, available_from, available_to, created_by, modified_by, created_on, modified_on, identifier, visible_in_menu, parent, list_children_on_page)[source]¶ Bases:
mptt.models.MPTTModel
,parler.models.TranslatableModel
-
created_by
¶
-
modified_by
¶
-
parent
¶
-
translations
¶
-
objects
= <django.db.models.manager.TreeManagerFromPageQuerySet object>¶
-
exception
DoesNotExist
¶
-
exception
Page.
MultipleObjectsReturned
¶
-
Page.
children
¶
-
Page.
content
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
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.
title
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
Page.
url
¶ Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
-
-
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.plugins.
PageLinksConfigForm
(**kwargs)[source]¶ Bases:
shoop.xtheme.plugins.forms.GenericPluginForm
A configuration for the PageLinksPlugin
-
clean
()[source]¶ A custom clean method to save page configuration information in a serializable form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.simple_cms.plugins.
PageLinksPlugin
(config)[source]¶ Bases:
shoop.xtheme.TemplatedPlugin
A plugin for displaying links to visible CMS pages in the shop front
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
identifier
= 'simple_cms.page_links'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/simple_cms/plugins/page_links.jinja'¶
-
editor_form_class
¶ alias of
PageLinksConfigForm
-
fields
= [('title', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7ff3ce5f5240>), ('show_all_pages', <django.forms.fields.BooleanField object at 0x7ff3d25a59e8>), ('hide_expired', <django.forms.fields.BooleanField object at 0x7ff3cede4978>), 'pages']¶
-
-
class
shoop.simple_cms.views.
PageView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
Page
-
slug_field
= 'translations__url'¶
-
slug_url_kwarg
= 'url'¶
-
template_name
= 'shoop/simple_cms/page.jinja'¶
-
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 wouldNo 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
-
-
class
shoop.simple_cms.
AppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.simple_cms'¶
-
verbose_name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
label
= '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'], 'xtheme_plugin': ['shoop.simple_cms.plugins:PageLinksPlugin']}¶
-
-
class
shoop.simple_supplier.admin_module.views.
StocksListView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.PicotableListView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/simple_supplier/admin/base_picotable.jinja'¶
-
model
¶ alias of
Product
-
columns
= [<shoop.admin.utils.picotable.Column object at 0x7ff3d0bdaf98>, <shoop.admin.utils.picotable.Column object at 0x7ff3ce806ba8>, <shoop.admin.utils.picotable.Column object at 0x7ff3d02f97f0>, <shoop.admin.utils.picotable.Column object at 0x7ff3d11549b0>, <shoop.admin.utils.picotable.Column object at 0x7ff3ceafbd68>]¶
-
-
class
shoop.simple_supplier.forms.
StockAdjustmentForm
(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([('purchase_price', <django.forms.fields.DecimalField object at 0x7ff3d02d42e8>), ('delta', <django.forms.fields.DecimalField object at 0x7ff3d15738d0>)])¶
-
declared_fields
= OrderedDict([('purchase_price', <django.forms.fields.DecimalField object at 0x7ff3d02d42e8>), ('delta', <django.forms.fields.DecimalField object at 0x7ff3d15738d0>)])¶
-
media
¶
-
-
class
shoop.simple_supplier.models.
StockAdjustment
(id, product, supplier, created_on, created_by, delta, purchase_price_value)[source]¶ Bases:
django.db.models.base.Model
-
product
¶
-
supplier
¶
-
created_by
¶
-
purchase_price
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
currency
¶
-
includes_tax
¶
-
exception
DoesNotExist
¶
-
exception
StockAdjustment.
MultipleObjectsReturned
¶
-
StockAdjustment.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
StockAdjustment.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
StockAdjustment.
objects
= <django.db.models.manager.Manager object>¶
-
-
class
shoop.simple_supplier.models.
StockCount
(id, product, supplier, logical_count, physical_count, stock_value_value)[source]¶ Bases:
django.db.models.base.Model
-
product
¶
-
supplier
¶
-
stock_value
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
stock_unit_price
¶ Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.
-
currency
¶
-
includes_tax
¶
-
stock_unit_price_value
¶
-
exception
DoesNotExist
¶
-
exception
StockCount.
MultipleObjectsReturned
¶
-
StockCount.
objects
= <django.db.models.manager.Manager object>¶
-
-
class
shoop.simple_supplier.module.
SimpleSupplierModule
(supplier, options)[source]¶ Bases:
shoop.core.suppliers.base.BaseSupplierModule
-
identifier
= 'simple_supplier'¶
-
name
= 'Simple Supplier'¶
-
-
shoop.simple_supplier.utils.
get_current_stock_value
(supplier_id, product_id)[source]¶ Count stock values for supplier and product combination
Logical count is events minus orders bought (not cancelled) describing how many products is currently orderable Physical count is events minus orders actually sent describing how many products is currently in stock
Parameters: - supplier_id – supplier_id to count stock values for
- product_id – product_id to count stock values for
Returns: logical and physical count for product
Return type:
-
shoop.simple_supplier.utils.
get_stock_information_html
(supplier, product)[source]¶ Get html string to show current stock information for product
Parameters: - supplier (shoop.core.models.Supplier) – shoop Supplier
- product (shoop.core.models.Product) – shoop Product
Returns: html div as a string
Return type:
-
shoop.simple_supplier.utils.
get_stock_adjustment_div
(request, supplier, product)[source]¶ Get html string to adjust stock values
Contains inputs for purchase_price_value and delta
Parameters: - request (django.http.HttpRequest) – HTTP request
- supplier (shoop.core.models.Supplier) – shoop Supplier
- product (shoop.core.models.Product) – shoop Product
Returns: html div as a string
Return type:
-
class
shoop.simple_supplier.
ShoopSimpleSupplierAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.simple_supplier'¶
-
verbose_name
= 'Shoop Simple Supplier'¶
-
label
= 'simple_supplier'¶
-
provides
= {'admin_product_form_part': ['shoop.simple_supplier.admin_module.forms:SimpleSupplierFormPart'], 'admin_module': ['shoop.simple_supplier.admin_module:StocksAdminModule'], 'supplier_module': ['shoop.simple_supplier.module:SimpleSupplierModule']}¶
-
-
class
shoop.testing.admin_module.mocker_view.
Mockers
[source]¶ Bases:
object
Namespace object for mocker methods.
The docstrings for the callables are user-visible.
-
class
shoop.testing.admin_module.mocker_view.
MockerForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= OrderedDict([('type', <django.forms.fields.ChoiceField object at 0x7ff3d1916e48>), ('count', <django.forms.fields.IntegerField object at 0x7ff3d1b336a0>)])¶
-
declared_fields
= OrderedDict([('type', <django.forms.fields.ChoiceField object at 0x7ff3d1916e48>), ('count', <django.forms.fields.IntegerField object at 0x7ff3d1b336a0>)])¶
-
media
¶
-
-
class
shoop.testing.admin_module.mocker_view.
MockerView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
form_class
¶ alias of
MockerForm
-
template_name
= 'shoop_testing/mocker.jinja'¶
-
mockers
= <shoop.testing.admin_module.mocker_view.Mockers object>¶
-
get_form
(form_class=None)¶
-
-
class
shoop.testing.models.
CarrierWithCheckoutPhase
(id, polymorphic_ctype, identifier, enabled, logo, serviceprovider_ptr, carrier_ptr, customcarrier_ptr)[source]¶ Bases:
shoop.core.models.CustomCarrier
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_shipping.DoesNotExist
-
exception
CarrierWithCheckoutPhase.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_shipping.MultipleObjectsReturned
-
CarrierWithCheckoutPhase.
base_objects
= <parler.managers.TranslatableManager object>¶
-
CarrierWithCheckoutPhase.
customcarrier_ptr
¶
-
CarrierWithCheckoutPhase.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
CarrierWithCheckoutPhase.
polymorphic_primary_key_name
= 'id'¶
-
CarrierWithCheckoutPhase.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.testing.models.
ExpensiveSwedenBehaviorComponent
(id, polymorphic_ctype, servicebehaviorcomponent_ptr)[source]¶ Bases:
shoop.core.models.ServiceBehaviorComponent
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_base.DoesNotExist
-
exception
ExpensiveSwedenBehaviorComponent.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_base.MultipleObjectsReturned
-
ExpensiveSwedenBehaviorComponent.
base_objects
= <django.db.models.manager.Manager object>¶
-
ExpensiveSwedenBehaviorComponent.
name
= 'Expenseefe-a Svedee Sheepping'¶
-
ExpensiveSwedenBehaviorComponent.
objects
= <polymorphic.managers.PolymorphicManager object>¶
-
ExpensiveSwedenBehaviorComponent.
polymorphic_primary_key_name
= 'id'¶
-
ExpensiveSwedenBehaviorComponent.
polymorphic_super_sub_accessors_replaced
= False¶
-
ExpensiveSwedenBehaviorComponent.
servicebehaviorcomponent_ptr
¶
-
exception
-
class
shoop.testing.models.
PaymentWithCheckoutPhase
(id, polymorphic_ctype, identifier, enabled, logo, serviceprovider_ptr, paymentprocessor_ptr, custompaymentprocessor_ptr)[source]¶ Bases:
shoop.core.models.CustomPaymentProcessor
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_payment.DoesNotExist
-
exception
PaymentWithCheckoutPhase.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_payment.MultipleObjectsReturned
-
PaymentWithCheckoutPhase.
base_objects
= <parler.managers.TranslatableManager object>¶
-
PaymentWithCheckoutPhase.
custompaymentprocessor_ptr
¶
-
PaymentWithCheckoutPhase.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
PaymentWithCheckoutPhase.
polymorphic_primary_key_name
= 'id'¶
-
PaymentWithCheckoutPhase.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.testing.models.
PseudoPaymentProcessor
(id, polymorphic_ctype, identifier, enabled, logo, serviceprovider_ptr, paymentprocessor_ptr, bg_color, fg_color)[source]¶ Bases:
shoop.core.models.PaymentProcessor
Replace Django’s inheritance accessor member functions for our model (self.__class__) with our own versions. We monkey patch them until a patch can be added to Django (which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then Django creates accessors like this: - ModelA: modelb - ModelB: modela_ptr, modelb, modelc - ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager. But they should not. So we replace them with our own accessors that use our appropriate base_objects manager.
-
exception
DoesNotExist
¶ Bases:
shoop.core.models._service_payment.DoesNotExist
-
exception
PseudoPaymentProcessor.
MultipleObjectsReturned
¶ Bases:
shoop.core.models._service_payment.MultipleObjectsReturned
-
PseudoPaymentProcessor.
base_objects
= <parler.managers.TranslatableManager object>¶
-
PseudoPaymentProcessor.
objects
= <shoop.core.models._base._PolyTransManager object>¶
-
PseudoPaymentProcessor.
paymentprocessor_ptr
¶
-
PseudoPaymentProcessor.
polymorphic_primary_key_name
= 'id'¶
-
PseudoPaymentProcessor.
polymorphic_super_sub_accessors_replaced
= False¶
-
exception
-
class
shoop.testing.factories.
FuzzyBoolean
(probability, **kwargs)[source]¶ Bases:
factory.fuzzy.BaseFuzzyAttribute
-
class
shoop.testing.factories.
UserFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
username
= <factory.declarations.Sequence object>¶
-
email
= <factory.declarations.Sequence object>¶
-
password
= <factory.declarations.PostGenerationMethodCall object>¶
-
first_name
= <factory.fuzzy.FuzzyText object>¶
-
last_name
= <factory.fuzzy.FuzzyText object>¶
-
-
class
shoop.testing.factories.
CompanyFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
name
= <factory.fuzzy.FuzzyText object>¶
-
vat_id
= <factory.fuzzy.FuzzyText object>¶
-
email
= <factory.declarations.Sequence object>¶
-
-
class
shoop.testing.factories.
ShopFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
slug
= <factory.fuzzy.FuzzyText object>¶
-
name
= <factory.fuzzy.FuzzyText object>¶
-
owner
= <factory.declarations.SubFactory object>¶
-
-
class
shoop.testing.factories.
ProductTypeFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
identifier
= <factory.declarations.Sequence object>¶
-
name
= <factory.fuzzy.FuzzyText object>¶
-
-
class
shoop.testing.factories.
SalesUnitFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
name
= <factory.fuzzy.FuzzyText object>¶
-
short_name
= <factory.fuzzy.FuzzyText object>¶
-
-
class
shoop.testing.factories.
CategoryFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
identifier
= <factory.declarations.Sequence object>¶
-
name
= <factory.fuzzy.FuzzyText object>¶
-
status
= <factory.fuzzy.FuzzyChoice object>¶
-
post
= <factory.declarations.PostGeneration object>¶
-
-
class
shoop.testing.factories.
ShopProductFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
visible
= <shoop.testing.factories.FuzzyBoolean object>¶
-
listed
= <shoop.testing.factories.FuzzyBoolean object>¶
-
purchasable
= <shoop.testing.factories.FuzzyBoolean object>¶
-
searchable
= <shoop.testing.factories.FuzzyBoolean object>¶
-
default_price_value
= <factory.fuzzy.FuzzyDecimal object>¶
-
-
class
shoop.testing.factories.
FuzzyName
(prefix='', length=12, suffix='', chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', **kwargs)[source]¶ Bases:
factory.fuzzy.FuzzyText
-
class
shoop.testing.factories.
ProductFactory
[source]¶ Bases:
factory.django.DjangoModelFactory
Would be called if trying to instantiate the class.
-
type
= <factory.declarations.LazyAttribute object>¶
-
sku
= <factory.fuzzy.FuzzyText object>¶
-
sales_unit
= <factory.declarations.LazyAttribute object>¶
-
tax_class
= <factory.declarations.LazyAttribute object>¶
-
profit_center
= <factory.fuzzy.FuzzyInteger object>¶
-
cost_center
= <factory.fuzzy.FuzzyInteger object>¶
-
name
= <shoop.testing.factories.FuzzyName object>¶
-
post
= <factory.declarations.PostGeneration object>¶
-
-
shoop.testing.factories.
get_payment_method
(shop=None, price=None, waive_at=None, name=None)[source]¶
-
shoop.testing.factories.
get_shipping_method
(shop=None, price=None, waive_at=None, name=None)[source]¶
-
shoop.testing.factories.
create_product
(sku, shop=None, supplier=None, default_price=None, **attrs)[source]¶
-
shoop.testing.factories.
add_product_to_order
(order, supplier, product, quantity, taxless_base_unit_price, tax_rate=0, pricing_context=None)[source]¶
-
shoop.testing.factories.
create_order_with_product
(product, supplier, quantity, taxless_base_unit_price, tax_rate=0, n_lines=1, shop=None)[source]¶
-
shoop.testing.factories.
create_random_person
(locale=None, minimum_name_comp_len=0)[source]¶ Create a random PersonContact from the given locale (or a random one).
The minimum length for name components can be given, to work around possible issues with components expecting a long-enough string.
Parameters: - locale (str|None) – Locale name
- minimum_name_comp_len (int) – Minimum name component length
Returns: Person contact
Return type:
-
class
shoop.testing.image_generator.
BaseImageGenerator
(image, palette, seed)[source]¶ Bases:
object
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
-
class
shoop.testing.image_generator.
RandomImageGenerator
(image, palette, seed)[source]¶ Bases:
shoop.testing.image_generator.BaseImageGenerator
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
-
class
shoop.testing.image_generator.
ModernArtImageGenerator
(image, palette, seed)[source]¶ Bases:
shoop.testing.image_generator.BaseImageGenerator
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
-
class
shoop.testing.image_generator.
RingImageGenerator
(image, palette, seed)[source]¶ Bases:
shoop.testing.image_generator.BaseImageGenerator
Parameters: - image (PIL.Image.Image) – The image to draw on
- palette – A list of RGB tuples
- seed (int) – Random generator seed
-
class
shoop.testing.service_forms.
PseudoPaymentProcessorForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
PseudoPaymentProcessorForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7ff3d59594e0>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d5959748>), ('bg_color', <django.forms.fields.CharField object at 0x7ff3d5959d30>), ('fg_color', <django.forms.fields.CharField object at 0x7ff3d5959320>), ('name', <django.forms.fields.CharField object at 0x7ff3cf9a9400>)])¶
-
PseudoPaymentProcessorForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3cf9a9400>)])¶
-
PseudoPaymentProcessorForm.
media
¶
-
-
class
shoop.testing.service_forms.
PaymentWithCheckoutPhaseForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
PaymentWithCheckoutPhase
-
exclude
= ['identifier']¶
-
-
PaymentWithCheckoutPhaseForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7ff3d5959a20>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d59595c0>), ('name', <django.forms.fields.CharField object at 0x7ff3d5959860>)])¶
-
PaymentWithCheckoutPhaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d5959860>)])¶
-
PaymentWithCheckoutPhaseForm.
media
¶
-
class
-
class
shoop.testing.service_forms.
CarrierWithCheckoutPhaseForm
(**kwargs)[source]¶ Bases:
shoop.admin.forms._base.ShoopAdminForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
CarrierWithCheckoutPhase
-
exclude
= ['identifier']¶
-
-
CarrierWithCheckoutPhaseForm.
base_fields
= OrderedDict([('enabled', <django.forms.fields.BooleanField object at 0x7ff3d5959f28>), ('logo', <filer.fields.image.AdminImageFormField object at 0x7ff3d5931e80>), ('name', <django.forms.fields.CharField object at 0x7ff3d5959048>)])¶
-
CarrierWithCheckoutPhaseForm.
declared_fields
= OrderedDict([('name', <django.forms.fields.CharField object at 0x7ff3d5959048>)])¶
-
CarrierWithCheckoutPhaseForm.
media
¶
-
class
-
class
shoop.testing.simple_checkout_phase.
TestPaymentCheckoutPhaseForm
(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([('input_field', <django.forms.fields.BooleanField object at 0x7ff3cff93198>)])¶
-
declared_fields
= OrderedDict([('input_field', <django.forms.fields.BooleanField object at 0x7ff3cff93198>)])¶
-
media
¶
-
-
class
shoop.testing.simple_checkout_phase.
TestShipmentCheckoutPhaseForm
(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([('input_field', <django.forms.fields.CharField object at 0x7ff3cff93668>)])¶
-
declared_fields
= OrderedDict([('input_field', <django.forms.fields.CharField object at 0x7ff3cff93668>)])¶
-
media
¶
-
-
class
shoop.testing.simple_checkout_phase.
TestMethodCheckoutPhase
(**kwargs)[source]¶ Bases:
shoop.front.checkout.CheckoutPhaseViewMixin
,django.views.generic.edit.FormView
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop_testing/simple_checkout_phase.jinja'¶
-
data_attribute
= None¶
-
storage_identifier
= None¶
-
-
class
shoop.testing.simple_checkout_phase.
TestPaymentCheckoutPhase
(**kwargs)[source]¶ Bases:
shoop.testing.simple_checkout_phase.TestMethodCheckoutPhase
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'test_payment_phase'¶
-
title
= 'Test Payment Phase'¶
-
form_class
¶ alias of
TestPaymentCheckoutPhaseForm
-
storage_identifier
= 'payment_with_checkout_phase'¶
-
data_attribute
= 'payment_data'¶
-
-
class
shoop.testing.simple_checkout_phase.
TestShipmentCheckoutPhase
(**kwargs)[source]¶ Bases:
shoop.testing.simple_checkout_phase.TestMethodCheckoutPhase
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
identifier
= 'test_shipment_phase'¶
-
title
= 'Test Shipment Phase'¶
-
form_class
¶ alias of
TestShipmentCheckoutPhaseForm
-
storage_identifier
= 'shipment_with_checkout_phase'¶
-
data_attribute
= 'shipping_data'¶
-
-
class
shoop.testing.simple_checkout_phase.
PaymentPhaseProvider
[source]¶ Bases:
shoop.front.checkout.BasicServiceCheckoutPhaseProvider
-
phase_class
¶ alias of
TestPaymentCheckoutPhase
-
service_provider_class
¶ alias of
PaymentWithCheckoutPhase
-
-
class
shoop.testing.simple_checkout_phase.
ShipmentPhaseProvider
[source]¶ Bases:
shoop.front.checkout.BasicServiceCheckoutPhaseProvider
-
phase_class
¶ alias of
TestShipmentCheckoutPhase
-
service_provider_class
¶ alias of
CarrierWithCheckoutPhase
-
-
shoop.testing.utils.
apply_request_middleware
(request, **attrs)[source]¶ Apply all the
process_request
capable middleware configured into the given request.Parameters: - request (django.http.HttpRequest) – The request to massage.
- attrs (dict) – Additional attributes to set after massage.
Returns: The same request, massaged in-place.
Return type:
-
class
shoop.testing.
ShoopTestingAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.testing'¶
-
verbose_name
= 'Shoop Testing & Demo Utilities'¶
-
label
= 'shoop_testing'¶
-
provides
= {'service_provider_admin_form': ['shoop.testing.service_forms:PseudoPaymentProcessorForm', 'shoop.testing.service_forms:PaymentWithCheckoutPhaseForm', 'shoop.testing.service_forms:CarrierWithCheckoutPhaseForm'], 'admin_module': ['shoop.testing.admin_module:TestingAdminModule'], 'front_service_checkout_phase_provider': ['shoop.testing.simple_checkout_phase.PaymentPhaseProvider', 'shoop.testing.simple_checkout_phase.ShipmentPhaseProvider']}¶
-
-
class
shoop.themes.classic_gray.plugins.
ProductHighlightPlugin
(config)[source]¶ Bases:
shoop.xtheme.TemplatedPlugin
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
identifier
= 'classic_gray.product_highlight'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'classic_gray/highlight_plugin.jinja'¶
-
fields
= [('title', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7ff3d10cb128>), ('type', <django.forms.fields.ChoiceField object at 0x7ff3cdae2908>), ('count', <django.forms.fields.IntegerField object at 0x7ff3d016d470>), ('orderable_only', <django.forms.fields.BooleanField object at 0x7ff3cda8cf98>)]¶
-
-
class
shoop.themes.classic_gray.plugins.
ProductCrossSellsPlugin
(config)[source]¶ Bases:
shoop.xtheme.TemplatedPlugin
-
identifier
= 'classic_gray.product_cross_sells'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'classic_gray/cross_sells_plugin.jinja'¶
-
required_context_variables
= ['product']¶
-
fields
= [('title', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7ff3cda8ccc0>), ('type', <enumfields.forms.EnumChoiceField object at 0x7ff3cdd6ed68>), ('count', <django.forms.fields.IntegerField object at 0x7ff3cda9cbe0>), ('orderable_only', <django.forms.fields.BooleanField object at 0x7ff3cf1354a8>)]¶
-
-
class
shoop.themes.classic_gray.
ClassicGrayTheme
(settings_obj=None)[source]¶ Bases:
shoop.xtheme.Theme
Initialize this theme, with an optional
ThemeSettings
objectParameters: settings_obj (ThemeSettings|None) – A theme settings object for this theme, if one exists. Passing this in will avoid extraneous database queries. -
identifier
= 'shoop.themes.classic_gray'¶
-
name
= 'Shoop Classic Gray Theme'¶
-
template_dir
= 'classic_gray/'¶
-
fields
= [('show_welcome_text', <django.forms.fields.BooleanField object at 0x7ff3d558bb70>)]¶
-
-
class
shoop.themes.classic_gray.
ClassicGrayThemeAppConfig
(*args, **kwargs)[source]¶ Bases:
shoop.apps.AppConfig
-
name
= 'shoop.themes.classic_gray'¶
-
verbose_name
= 'Shoop Classic Gray Theme'¶
-
label
= 'shoop.themes.classic_gray'¶
-
provides
= {'xtheme': 'shoop.themes.classic_gray:ClassicGrayTheme', 'xtheme_plugin': ['shoop.themes.classic_gray.plugins:ProductHighlightPlugin', 'shoop.themes.classic_gray.plugins:ProductCrossSellsPlugin']}¶
-
-
class
shoop.utils.analog.
LogEntryKind
[source]¶ Bases:
enumfields.enums.Enum
An enumeration.
-
OTHER
= <LogEntryKind.OTHER: 0>¶
-
AUDIT
= <LogEntryKind.AUDIT: 1>¶
-
EDIT
= <LogEntryKind.EDIT: 2>¶
-
DELETION
= <LogEntryKind.DELETION: 3>¶
-
NOTE
= <LogEntryKind.NOTE: 4>¶
-
EMAIL
= <LogEntryKind.EMAIL: 5>¶
-
WARNING
= <LogEntryKind.WARNING: 6>¶
-
ERROR
= <LogEntryKind.ERROR: 7>¶
-
-
class
shoop.utils.analog.
BaseLogEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
target
= None¶
-
user
¶
-
kind
¶ A placeholder class that provides a way to set the attribute on the model.
-
extra
¶ A placeholder class that provides a way to set the attribute on the model.
-
BaseLogEntry.
get_kind_display
(*moreargs, **morekwargs)¶
-
BaseLogEntry.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
BaseLogEntry.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
-
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_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_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_image_from_upload
(request, path, upload_data, sha1=None)[source]¶ Create a Filer Image from an upload (UploadedFile or such). If the
sha1
parameter is passed and an Image with said SHA1 is found, it will be returned instead.Parameters: - request (django.http.request.HttpRequest|None) – Request, to figure out the owner for this file
- path (basestring|filer.models.Folder) – Pathname string (see
filer_folder_from_path
) or a Filer Folder. - upload_data (django.core.files.base.File) – Upload data
- sha1 (basestring) – SHA-1 checksum of the data, if available, to do deduplication
Return type: filer.models.imagemodels.Image
-
shoop.utils.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 thesha1
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
-
exception
shoop.utils.form_group.
FormInstantiationAttributeError
[source]¶ Bases:
Exception
AttributeErrors occurring within the
forms
property are transmogrified into these.
-
class
shoop.utils.form_group.
FormDef
(name, form_class, required=True, kwargs=None)[source]¶ Bases:
object
-
shoop.utils.i18n.
get_babel_locale
[source]¶ Parse a Django-format (dash-separated) locale string and return a Babel locale.
This function is decorated with lru_cache, so executions should be cheap even if
babel.Locale.parse()
most definitely is not.Parameters: locale_string (str) – A locale string (“en-US”, “fi-FI”, “fi”) Returns: Babel Locale Return type: babel.Locale
-
shoop.utils.i18n.
get_current_babel_locale
(fallback='en-US-POSIX')[source]¶ Get a Babel locale based on the thread’s locale context.
Parameters: fallback – Locale to fallback to; set to None to raise an exception instead. Returns: Babel Locale Return type: babel.Locale
-
shoop.utils.i18n.
get_locally_formatted_datetime
(datetime)[source]¶ Return a formatted, localized version of datetime based on the current context.
-
shoop.utils.i18n.
format_money
(amount, digits=None, widen=0, locale=None)[source]¶ Format a Money object in the given locale.
If neither digits or widen is passed, the preferred number of digits for the amount’s currency is used.
Parameters: - amount (Money) – The Money object to format
- digits (int|None) – How many digits to format the currency with.
- widen (int|None) – How many digits to widen any existing decimal width with.
- locale (Locale|str) – Locale object or locale identifier
Returns: Formatted string
Return type:
-
shoop.utils.i18n.
get_language_name
(language_code)[source]¶ Get a language’s name in the currently active locale.
Parameters: language_code (str) – Language code (possibly with an added script suffix (zh_Hans, zh-Hans)) Returns: The language name, or the code if the language couldn’t be derived. Return type: str
-
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:
-
shoop.utils.iterables.
batch
(iterable, count)[source]¶ Yield batches of
count
items from the given iterable.>>> tuple(x for x in batch([1, 2, 3, 4, 5, 6, 7], 3)) ([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]]
-
class
shoop.utils.money.
Money
[source]¶ Bases:
shoop.utils.numbers.UnittedDecimal
Money value with currency.
The pure decimal value is available from the base classes
value
property (preferred way) or by casting toDecimal
.Money objects with different currencies cannot be compared or calculated with and will raise
UnitMixupError
.See
__new__
.Create new Money instance with given value and currency.
If no currency is given explicitly and
value
has a property namedcurrency
, then that will be used. Otherwise currency is a required argument and not passing one will raise a TypeError.Parameters: - value (str|numbers.Number) – Value as string or number
- currency (str|None) – Currency as ISO-4217 code (3-letter string) or None.
-
shoop.utils.numbers.
strip_non_float_chars
(s)[source]¶ Strips characters that aren’t part of normal floats.
-
shoop.utils.numbers.
parse_decimal_string
(s)[source]¶ Parse decimals with “best effort”.
Parses a string (or unicode) that may be embellished with spaces and other weirdness into the most probable Decimal.
Parameters: s (str) – Input value Returns: Decimal Return type: Decimal
-
shoop.utils.numbers.
get_string_sort_order
(s)[source]¶ Return a sorting order value for a string that contains a garment size.
Parameters: s (str) – Input value (string or number) Returns: Sorting tuple Return type: tuple
-
class
shoop.utils.numbers.
UnittedDecimal
¶ 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 ofUnittedDecimal
.-
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: UnittedDecimal
-
value
¶ Value of this decimal without the unit.
Return type: decimal.Decimal
-
-
exception
shoop.utils.numbers.
UnitMixupError
(obj1, obj2, msg='Unit mixup')¶ Bases:
TypeError
Invoked operation for UnittedDecimal and object with non-matching unit.
The objects involved are stored in instance variables
obj1
andobj2
. Former is instance ofUnittedDecimal
or its subclass and the other could be any object.Variables: - obj1 (UnittedDecimal) – Involved object 1
- obj2 (Any) – Involved object 2
-
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.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 incomparee
.This differs from a raw == in that keys that do not exist in
source
may exist incomparee
.Parameters: Return type: Returns: True or False
-
shoop.utils.objects.
compact
(in_obj, none_only=True, deep=True)[source]¶ Compact iterable by removing falsy values.
Iterable may be a mapping or a list.
By default uses
not value
to test for falseness, but ifnone_only
is set, will usevalue is None
.By default, iterables within the iterable are also compacted. This can be controlled by the
deep
argument.Parameters: Returns: Flattened iterable
Return type: list|dict
-
class
shoop.utils.patterns.
Pattern
(pattern_text)[source]¶ Bases:
object
Compile a pattern from the given
pattern_text
.Patterns are comma-separated atoms of the forms:
*
– matches anythingtext
– matched directlymin-max
– inclusive range matched lexicographically OR as integers if possiblewild*
– wildcards (asterisks and question marks allowed)
In addition, atoms may be prefixed with
to negate them.
For instance, “10-20,!15” would match all strings (or numbers) between 10 and 20, but not 15.
-
shoop.utils.patterns.
pattern_matches
(pattern, target)[source]¶ Verify that a
target
string matches the given pattern.For pattern strings, compiled patterns are cached.
Parameters: - pattern (str|Pattern) – The pattern. Either a pattern string or a Pattern instance
- target (str) – Target string to test against.
Returns: Whether the test succeeded.
Return type:
-
class
shoop.utils.properties.
MoneyProperty
(value, currency)[source]¶ Bases:
object
Property for a Money amount.
Will return
Money
objects when the property is being get and acceptsMoney
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 theMoneyProperty
.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 anUnitMixupError
.Initialize MoneyProperty with given field locators.
Parameters: -
value_class
¶ alias of
Money
-
-
class
shoop.utils.properties.
PriceProperty
(value, currency, includes_tax, **kwargs)[source]¶ Bases:
shoop.utils.properties.MoneyProperty
Property for Price object.
Similar to
MoneyProperty
but also hasincludes_tax
field.Operaters with
TaxfulPrice
andTaxlessPrice
objects.Initialize PriceProperty with given field locators.
Parameters: -
value_class
¶ alias of
Price
-
-
class
shoop.utils.properties.
TaxfulPriceProperty
(value, currency)[source]¶ Bases:
shoop.utils.properties.MoneyProperty
Initialize MoneyProperty with given field locators.
Parameters: -
value_class
¶ alias of
TaxfulPrice
-
-
class
shoop.utils.properties.
TaxlessPriceProperty
(value, currency)[source]¶ Bases:
shoop.utils.properties.MoneyProperty
Initialize MoneyProperty with given field locators.
Parameters: -
value_class
¶ alias of
TaxlessPrice
-
-
class
shoop.utils.properties.
MoneyPropped
(*args, **kwargs)[source]¶ Bases:
object
Mixin for transforming MoneyProperty init parameters.
Add this mixin as (first) base for the class that has
MoneyProperty
properties and this will make its__init__
transform passed kwargs to the fields specified in theMoneyProperty
.
-
class
shoop.utils.serialization.
ExtendedJSONEncoder
(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ Bases:
django.core.serializers.json.DjangoJSONEncoder
Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped.
If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters.
If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place.
If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.
If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.
If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.
If specified, separators should be an (item_separator, key_separator) tuple. The default is (‘, ‘, ‘: ‘) if indent is
None
and (‘,’, ‘: ‘) otherwise. To get the most compact JSON representation, you should specify (‘,’, ‘:’) to eliminate whitespace.If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a
TypeError
.
-
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.
>>> print(flatten("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.
snake_case
(value)[source]¶ Snake_case the given value (join words with underscores). No other treatment is done; use
identifierify
for that.
-
shoop.utils.text.
kebab_case
(value)[source]¶ Kebab-case the given value (join words with dashes). No other treatment is done; use
identifierify
for that.
-
shoop.utils.text.
camel_case
(value)[source]¶ CamelCase the given value (join capitalized words). No other treatment is done; use
identifierify
for that.
-
shoop.utils.text.
space_case
(value)[source]¶ Space case the given value (join words that may have been otherwise separated with spaces). No other treatment is done; use
identifierify
for that.
-
shoop.utils.translation.
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
-
shoop.utils.
update_module_attributes
(object_names, module_name)[source]¶ Update __module__ attribute of objects in module.
Set the
__module__
attribute of the objects (resolved by the given object names from the given module name) tomodule_name
.Use case for this function in Shoop is to hide the actual location of objects imported from private submodules, so that they will show up nicely in the Sphinx generated API documentation. This is done by appending following line to the end of the
__init__.py
of the main package:update_module_attributes(__all__, __name__)
Parameters: - object_names (Iterable[str]) – Names of the objects to update.
- module_name (str) – Name of the module where the objects reside and also the new value
which will be assigned to
__module__
attribute of each object.
-
class
shoop.xtheme.admin_module.views.
ActivationForm
(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
A very simple form for activating a theme.
-
base_fields
= OrderedDict([('activate', <django.forms.fields.CharField object at 0x7ff3cd82e400>)])¶
-
declared_fields
= OrderedDict([('activate', <django.forms.fields.CharField object at 0x7ff3cd82e400>)])¶
-
media
¶
-
-
class
shoop.xtheme.admin_module.views.
ThemeConfigView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.FormView
A view for listing and activating themes.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
template_name
= 'shoop/xtheme/admin/config.jinja'¶
-
form_class
¶ alias of
ActivationForm
-
-
class
shoop.xtheme.admin_module.views.
ThemeConfigDetailView
(**kwargs)[source]¶ Bases:
shoop.admin.utils.views.CreateOrUpdateView
A view for configuring a single theme.
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
-
model
¶ alias of
ThemeSettings
-
template_name
= 'shoop/xtheme/admin/config_detail.jinja'¶
-
form_class
¶ alias of
Form
-
context_object_name
= 'theme_settings'¶
-
add_form_errors_as_messages
= True¶
-
get_theme
()[source]¶ Get the theme object to configure.
Returns: Theme object Return type: shoop.xtheme.Theme
-
-
class
shoop.xtheme.admin_module.
XthemeAdminModule
[source]¶ Bases:
shoop.admin.base.AdminModule
Admin module for Xtheme.
Allows theme activation/deactivation and further configuration.
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
-
class
shoop.xtheme.plugins.category_links.
CategoryLinksConfigForm
(**kwargs)[source]¶ Bases:
shoop.xtheme.plugins.forms.GenericPluginForm
A configuration form for the CategoryLinksPlugin
-
clean
()[source]¶ A custom clean method to save category configuration information in a serializable form
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.xtheme.plugins.category_links.
CategoryLinksPlugin
(config)[source]¶ Bases:
shoop.xtheme.TemplatedPlugin
A plugin for displaying links to visible categories on the shop front
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
identifier
= 'category_links'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/xtheme/plugins/category_links.jinja'¶
-
editor_form_class
¶ alias of
CategoryLinksConfigForm
-
fields
= [('title', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7ff3d0560860>), ('show_all_categories', <django.forms.fields.BooleanField object at 0x7ff3d05607f0>), 'categories']¶
-
-
shoop.xtheme.plugins.consts.
FALLBACK_LANGUAGE_CODE
= '*'¶ The pseudo-language code used by TranslatedFields and the relevant Plugin API to mark the untranslated/fallback content
-
class
shoop.xtheme.plugins.forms.
PluginForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
Base class for plugin configuration forms.
-
get_config
()[source]¶ Get the new
config
dict for a plugin.Called when the form is valid, akin to
django.forms.models.ModelForm.save
.The default implementation just augments the old config with the cleaned data for the form.
Returns: A new JSONable (!) config dict Return type: dict
-
base_fields
= OrderedDict()¶
-
declared_fields
= OrderedDict()¶
-
media
¶
-
-
class
shoop.xtheme.plugins.image.
ImagePluginChoiceWidget
(attrs=None, clearable=False, empty_text='—')[source]¶ Bases:
shoop.admin.forms.widgets.ImageChoiceWidget
Subclass of ImageChoiceWidget that will not raise an exception if given an invalid initial image ID (in case the image has been deleted)
-
media
¶
-
-
class
shoop.xtheme.plugins.image.
ImageIDField
(max_value=None, min_value=None, *args, **kwargs)[source]¶ Bases:
django.forms.fields.IntegerField
A custom field that stores the ID value of a Filer image and presents Shoop admin’s image popup widget
-
widget
= <shoop.xtheme.plugins.image.ImagePluginChoiceWidget object>¶
-
-
class
shoop.xtheme.plugins.image.
ImagePlugin
(config)[source]¶ Bases:
shoop.xtheme.TemplatedPlugin
A linkable image plugin
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
identifier
= 'images'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
template_name
= 'shoop/xtheme/plugins/image.jinja'¶
-
fields
= [('title', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7ff3cd30d2e8>), ('image_id', <shoop.xtheme.plugins.image.ImageIDField object at 0x7ff3cd9a0080>), ('url', <django.forms.fields.URLField object at 0x7ff3d0560518>), ('full_width', <django.forms.fields.BooleanField object at 0x7ff3cdddd320>), ('width', <django.forms.fields.IntegerField object at 0x7ff3cd30f9b0>), ('height', <django.forms.fields.IntegerField object at 0x7ff3d02f5320>)]¶
-
-
class
shoop.xtheme.plugins.snippets.
SnippetsPlugin
(config)[source]¶ Bases:
shoop.xtheme.Plugin
Simple plugin class for including snippets and resources on the page, mostly for simple integrations.
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
identifier
= 'snippets'¶
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
fields
= [('in_place', <django.forms.fields.CharField object at 0x7ff3d131bfd0>), ('head_end', <django.forms.fields.CharField object at 0x7ff3cd50fe48>), ('body_start', <django.forms.fields.CharField object at 0x7ff3cd50feb8>), ('body_end', <django.forms.fields.CharField object at 0x7ff3cd50f438>)]¶
-
Bases:
shoop.xtheme.plugins.forms.GenericPluginForm
Form for the social media links xtheme plugin. One field is provided for each entry in the plugin’s icon_classes attribute, which maps social media site names to font-awesome icon classes by default.
Populates form with default plugin fields as well as any social media link type included in the plugin’s
icon_classes
attribute.Also adds an ordering field for each link type to change display order.
Returns cleaned data from default plugin fields and any link fields.
Processed link configuration information is stored and returned as a dictionary (
links
).
Bases:
shoop.xtheme.TemplatedPlugin
An xtheme plugin for displaying site links to common social media sites.
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data alias of
SocialMediaLinksPluginForm
Returns plugin settings and a sorted list of social media links
Returns: Plugin context data Return type: dict
Returns the list of social media links sorted according to ordering
Returns: List of link tuples (ordering, icon class, url) Return type: [(int, str, str)]
-
class
shoop.xtheme.plugins.text.
TextPlugin
(config)[source]¶ Bases:
shoop.xtheme.Plugin
Very basic Markdown rendering plugin.
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
identifier
= 'text'¶
-
name
= 'Text'¶
-
fields
= [('text', <shoop.xtheme.plugins.forms.TranslatableField object at 0x7ff3cd84a080>)]¶
-
-
class
shoop.xtheme.plugins.widgets.
TranslatableFieldWidget
(languages, input_widget=<class 'django.forms.widgets.TextInput'>, attrs=None)[source]¶ Bases:
django.forms.widgets.Widget
-
media
¶
-
-
class
shoop.xtheme.plugins.widgets.
XThemeModelChoiceWidget
(attrs=None, choices=())[source]¶ Bases:
django.forms.widgets.Select
-
media
¶
-
-
class
shoop.xtheme.plugins.widgets.
XThemeModelChoiceField
(queryset, empty_label='---------', cache_choices=None, required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, *args, **kwargs)[source]¶ Bases:
django.forms.models.ModelChoiceField
-
widget
¶ alias of
XThemeModelChoiceWidget
-
-
shoop.xtheme.views.command.
handle_command
(request, command)[source]¶ Internal dispatch function.
Parameters: - request (django.http.HttpRequest) – A request
- command (str) – Command string
Returns: A response
Return type:
-
shoop.xtheme.views.command.
command_dispatch
(request)[source]¶ Xtheme command dispatch view.
Parameters: request (django.http.HttpRequest) – A request Returns: A response Return type: django.http.HttpResponse
-
shoop.xtheme.views.extra.
extra_view_dispatch
(request, view)[source]¶ Dispatch to an Xtheme extra view.
Parameters: - request (django.http.HttpRequest) – A request
- view (str) – View name
Returns: A response of some ilk
Return type:
-
class
shoop.xtheme.views.forms.
LayoutCellGeneralInfoForm
(**kwargs)[source]¶ Bases:
django.forms.forms.Form
-
CELL_FULL_WIDTH
= 12¶
-
CELL_WIDTH_CHOICES
= [(12, <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d407a048>), (9, <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d407a160>), (8, <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d40dc6d8>), (6, <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d407a198>), (4, <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d407a1d0>), (3, <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7ff3d407a208>)]¶
-
save
()[source]¶ Save size configuration. Plugin configuration is done via JavaScript POST.
Both breakpoints (
sm`and `md
) are set to same value defined incell_width_field
. The reason for this is that the difference between these breakpoints is so minor that manually assigning both of these by shop admin introduces too much complexity to row-cell management UI.
-
base_fields
= OrderedDict([('plugin', <django.forms.fields.ChoiceField object at 0x7ff3d40eb978>)])¶
-
declared_fields
= OrderedDict([('plugin', <django.forms.fields.ChoiceField object at 0x7ff3d40eb978>)])¶
-
media
¶
-
-
class
shoop.xtheme.views.forms.
LayoutCellFormGroup
(**kwargs)[source]¶ Bases:
shoop.utils.form_group.FormGroup
Form group containing the LayoutCellGeneralInfoForm and a possible plugin-dependent configuration form.
-
shoop.xtheme.editing.
could_edit
(request)[source]¶ Return true if the context of the given request would allow Xtheme editing.
Parameters: request (django.http.HttpRequest) – HTTP request Returns: Would allow editing? Return type: bool
-
shoop.xtheme.editing.
is_edit_mode
(request)[source]¶ Return true if the given request has xtheme editing enabled.
Parameters: request (django.http.HttpRequest) – HTTP request Returns: In edit mode? Return type: bool
-
shoop.xtheme.editing.
set_edit_mode
(request, flag)[source]¶ Enable or disable edit mode for the request.
Parameters: - request (django.http.HttpRequest) – HTTP request
- flag (bool) – Enable flag
-
shoop.xtheme.editing.
may_inject
(context)[source]¶ Figure out if we may inject Xtheme editing into this view.
The requirements are that there is a CBV
view
object in the context, and thatview
object does not explicitly opt-out of editing withxtheme_injection = False
Parameters: context (jinja2.runtime.Context) – Jinja rendering context Returns: Permission bool Return type: bool
-
class
shoop.xtheme.engine.
XthemeTemplate
[source]¶ Bases:
jinja2.environment.Template
A subclass of Jinja templates with additional post-processing magic.
-
class
shoop.xtheme.engine.
XthemeEnvironment
(block_start_string='{%', block_end_string='%}', variable_start_string='{{', variable_end_string='}}', comment_start_string='{#', comment_end_string='#}', line_statement_prefix=None, line_comment_prefix=None, trim_blocks=False, lstrip_blocks=False, newline_sequence='n', keep_trailing_newline=False, extensions=(), optimized=True, undefined=<class 'jinja2.runtime.Undefined'>, finalize=None, autoescape=False, loader=None, cache_size=400, auto_reload=True, bytecode_cache=None)[source]¶ Bases:
jinja2.environment.Environment
Overrides the usual template class and allows dynamic switching of Xthemes.
Enable by adding
"environment": "shoop.xtheme.engine.XthemeEnvironment"
in yourTEMPLATES
settings.-
template_class
¶ alias of
XthemeTemplate
-
get_template
(name, parent=None, globals=None)[source]¶ Load a template from the loader. If a loader is configured this method asks the loader for the template and returns a
Template
.Parameters: - name (str) – Template name.
- parent (str|None) – If the
parent
parameter is notNone
,join_path
is called to get the real template name before loading. - globals (dict|None) – The
globals
parameter can be used to provide template wide globals. These variables are available in the context at render time.
Returns: Template object
Return type:
-
get_or_select_template
(template_name_or_list, parent=None, globals=None)[source]¶ Does a typecheck and dispatches to
select_template
orget_template
.Parameters: - template_name_or_list (str|Iterable[str]) – Template name or list
- parent (str|None) – If the
parent
parameter is notNone
,join_path
is called to get the real template name before loading. - globals – The
globals
parameter can be used to provide template wide globals. These variables are available in the context at render time.
Returns: Template object
Return type:
-
-
shoop.xtheme.engine.
concat
()¶ S.join(iterable) -> str
Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.
-
class
shoop.xtheme.forms.
GenericThemeForm
(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm
A generic form for Xthemes; populates itself based on
fields
in the theme class.-
GenericThemeForm.
base_fields
= OrderedDict()¶
-
GenericThemeForm.
declared_fields
= OrderedDict()¶
-
GenericThemeForm.
media
¶
-
GenericThemeForm.
save
(commit=True)[source]¶ Save theme settings into the ThemeSettings instance
Parameters: commit (bool) – Commit flag. Ignored, but there for compatibility with the superclass. Returns: The now saved ThemeSettings
instanceReturn type: shoop.xtheme.models.ThemeSettings
-
-
class
shoop.xtheme.layout.
LayoutCell
(plugin_identifier, config=None, sizes=None)[source]¶ Bases:
object
A single cell in a layout. Maps to Bootstrap’s
col-XX-XX
classes.Initialize a layout cell with a given plugin, config and sizing configuration.
Parameters: - plugin_identifier (str) – Plugin identifier string
- config (dict|None) – Config dict
- sizes (dict|None) – Size dict
-
plugin_class
¶ Get the actual plugin class for this cell, or None if the plugin class isn’t available.
Returns: Plugin or None. Return type: Plugin|None
-
plugin_name
¶ Get the name of the plugin in this cell for display purposes.
Returns: Plugin name string Return type: str
-
instantiate_plugin
()[source]¶ Instantiate the plugin with the current config.
Returns: Instantiated plugin (if a class is available) Return type: Plugin|None
-
render
(context)[source]¶ Return the plugin’s rendered contents.
Parameters: context (jinja2.runtime.Context) – Jinja2 rendering context. Returns: string of content Return type: str
-
classmethod
unserialize
(data)[source]¶ Unserialize a dict of layout cell data into a new cell.
Parameters: data (dict) – Layout cell data dict Returns: New cell Return type: LayoutCell
-
class
shoop.xtheme.layout.
LayoutRow
(cells=None)[source]¶ Bases:
object
A single row in a layout. Maps to Bootstrap’s
row
class.Parameters: cells – Optional iterable of LayoutCells to populate this LayoutRow with. -
classmethod
unserialize
(data)[source]¶ Unserialize a dict of layout row data into a new row, along with all cell children.
Parameters: data (dict) – Layout row data dict Returns: New row Return type: LayoutRow
-
add_cell
(sizes=None)[source]¶ Add an empty cell to this row. Used by the editor API.
Parameters: sizes (dict|None) – An optional size dict, see LayoutCell
Returns: The new layout cell Return type: LayoutCell
-
classmethod
-
class
shoop.xtheme.layout.
Layout
(placeholder_name, rows=None)[source]¶ Bases:
object
The layout (row, cell and plugin configuration) for a single placeholder.
Parameters: - placeholder_name (str|None) – The name of the placeholder. Could be None.
- rows (Iterable[LayoutRow]|None) – Optional iterable of LayoutRows to populate this Layout with.
-
row_class
= 'row'¶
-
cell_class_template
= 'col-%(breakpoint)s-%(width)s'¶
-
hide_cell_class_template
= 'hidden-%(breakpoint)s'¶
-
classmethod
unserialize
(data, placeholder_name=None)[source]¶ Unserialize a dict of layout data into a new layout, with all rows and cells.
Parameters: Returns: New layout
Return type:
-
begin_row
()[source]¶ Begin a new row in the layout.
This is internally used by
LayoutPartExtension
, but could just as well be used to programmatically create layouts for whichever purpose.Returns: The newly created row Return type: LayoutRow
-
begin_column
(sizes=None)[source]¶ Begin a new column (cell) in the layout, in the last row.
If no rows exist, one is implicitly created, for your convenience. The newly created cell has no plugin or configuration.
This is internally used by
LayoutPartExtension
, but could just as well be used to programmatically create layouts for whichever purpose.Parameters: sizes – The size dictionary to pass to LayoutCell
.Returns: The newly created cell Return type: LayoutCell
-
add_plugin
(plugin_identifier, config)[source]¶ Configure a plugin in the last row and cell of the layout.
If no rows or cells exist, one row and one cell is implicitly created.
This is internally used by
LayoutPartExtension
, but could just as well be used to programmatically create layouts for whichever purpose.Parameters: Returns: The configured cell
Return type:
-
get_cell
(x, y)[source]¶ Get a layout cell indicated by the given (zero-based) coordinates.
If the coordinates are out of range, returns None.
Parameters: Returns: Layout cell
Return type: LayoutCell|None
-
insert_row
(y=None)[source]¶ Insert a new row at the given zero-based row and return it.
If
y
is None, the row in inserted at the end.Parameters: y (int) – Y coordinate Returns: The new layout row Return type: LayoutRow
-
class
shoop.xtheme.models.
SavedViewConfigQuerySet
(model=None, query=None, using=None, hints=None)[source]¶ Bases:
django.db.models.query.QuerySet
-
appropriate
(theme, view_name, draft)[source]¶ Get an “appropriate”
SavedViewConfig
for the parameters given.When draft mode is off:
- A PUBLIC SavedViewConfig is returned, or a new one in CURRENT_DRAFT status.
When draft mode is on:
- A CURRENT_DRAFT SavedViewConfig is returned, if one exists.
- If a PUBLIC SavedViewConfig exists, its data is copied into a new, unsaved CURRENT_DRAFT SavedViewConfig.
Parameters: - theme (shoop.xtheme.Theme) – Theme instance
- view_name (str) – View name string
- draft (bool) – Draft mode flag
Returns: SavedViewConfig (possibly not saved)
Return type:
-
-
class
shoop.xtheme.models.
SavedViewConfigStatus
[source]¶ Bases:
enumfields.enums.Enum
Stati for SavedViewConfigs.
The lifecycle for SavedViewConfigs (SVCs) for a given (theme, view) pair is as follows:
- Initially, there’s zero SVCs.
- When a placeholder layout is saved in edit mode, an SVC in the CURRENT_DRAFT status is saved.
- When an SVC in CURRENT_DRAFT status is published, all other SVCs for the theme/view pair are “demoted” to being OLD_VERSIONs and the CURRENT_DRAFT SVC is promoted to being the PUBLIC one (and there should always be zero or one PUBLIC SavedViewConfigs per (theme, view) pair).
- When an SVC in CURRENT_DRAFT status is reverted, it is simply deleted.
- When an SVC has been published and edit mode is entered again, the current PUBLIC SVC is copied into a new CURRENT_DRAFT version.
-
CURRENT_DRAFT
= <SavedViewConfigStatus.CURRENT_DRAFT: 1>¶
-
OLD_VERSION
= <SavedViewConfigStatus.OLD_VERSION: 2>¶
-
PUBLIC
= <SavedViewConfigStatus.PUBLIC: 3>¶
-
class
shoop.xtheme.models.
SavedViewConfig
(id, theme_identifier, view_name, created_on, status, _data)[source]¶ Bases:
django.db.models.base.Model
-
status
¶ A placeholder class that provides a way to set the attribute on the model.
-
objects
= <django.db.models.manager.ManagerFromSavedViewConfigQuerySet object>¶
-
draft
¶
-
exception
DoesNotExist
¶
-
exception
SavedViewConfig.
MultipleObjectsReturned
¶
-
SavedViewConfig.
get_next_by_created_on
(*moreargs, **morekwargs)¶
-
SavedViewConfig.
get_previous_by_created_on
(*moreargs, **morekwargs)¶
-
SavedViewConfig.
get_status_display
(*moreargs, **morekwargs)¶
-
-
class
shoop.xtheme.models.
ThemeSettings
(id, theme_identifier, active, data)[source]¶ Bases:
django.db.models.base.Model
-
data
¶ A placeholder class that provides a way to set the attribute on the model.
-
exception
DoesNotExist
¶
-
exception
ThemeSettings.
MultipleObjectsReturned
¶
-
ThemeSettings.
objects
= <django.db.models.manager.Manager object>¶
-
-
exception
shoop.xtheme.parsing.
Unflattenable
[source]¶ Bases:
Exception
Exception raised when a node list can’t be flattened into a constant.
-
exception
shoop.xtheme.parsing.
NonConstant
[source]¶ Bases:
ValueError
Exception raised when something expected to be constant... is not.
-
exception
shoop.xtheme.parsing.
NestingError
[source]¶ Bases:
ValueError
Exception raised when a template’s placeholder/column/row/plugin hierarchy is out of whack.
-
shoop.xtheme.parsing.
flatten_const_node_list
(environment, node_list)[source]¶ Try to flatten the given node list into a single string.
Parameters: - environment (jinja2.environment.Environment) – Jinja2 environment
- node_list (list[jinja2.nodes.Node]) – List of nodes
Returns: String of content
Return type: Raises: Unflattenable – Raised when the node list can’t be flattened into a constant
-
shoop.xtheme.parsing.
parse_constantlike
(environment, parser)[source]¶ Parse the next expression as a “constantlike” expression.
Expression trees that fold into constants are constantlike, as are bare variable names.
Parameters: - environment (jinja2.environment.Environment) – Jinja2 environment
- parser (jinja2.parser.Parser) – Template parser
Returns: constant value of any type
Return type:
-
shoop.xtheme.parsing.
noop_node
(lineno)[source]¶ Return a no-op node (compiled into a single
0
).Parameters: lineno (int) – Line number for the node Returns: Node Return type: jinja2.nodes.ExprStmt
-
class
shoop.xtheme.parsing.
PlaceholderExtension
(environment)[source]¶ Bases:
shoop.xtheme.parsing._PlaceholderManagingExtension
PlaceholderExtension
manages{% placeholder <NAME> [global] %}
...{% endplaceholder %}
.
- The
name
can be any Jinja2 expression that can be folded into a constant, with the addition of bare variable names such asname
meaning the same as"name"
. This makes it slightly easier to write templates. - The body of this block is actually discarded; only the inner
column
,row
andplugin
directives have any meaning. (A parser-timeLayout
object is created and populated during parsing of this block.) - An optional
global
parameter can be used to specify that the configuration for this placeholder should be “global” across different views (although currently that only applies to placeholders within the same template, i.e, if you defined the same global placeholder in different templates they will not share configuration, but an included or base template that is rendered by different views will).
-
parse
(parser)[source]¶ Parse a placeholder!
Parameters: parser (jinja2.parser.Parser) – Template parser Returns: Output node for rendering a placeholder. Return type: jinja2.nodes.Output
-
identifier
= 'shoop.xtheme.parsing.PlaceholderExtension'¶
-
class
shoop.xtheme.parsing.
LayoutPartExtension
(environment)[source]¶ Bases:
shoop.xtheme.parsing._PlaceholderManagingExtension
Parser for row and column tags.
Syntax for the row and column tags is:
{% row %} {% column [SIZES] %}...{% endcolumn %} {% endrow %}
- Rows map to
LayoutRow
objects and columns map toLayoutCell
. - For a single-cell layout, these are not necessary.
{% plugin %}
invocations without preceding{% row %}
/{% column %}
directives imply a single row and a single column.
-
parse
(parser)[source]¶ Parse a column or row.
Parameters: parser (jinja2.parser.Parser) – Template parser Returns: A null output node. Return type: jinja2.nodes.Node
-
identifier
= 'shoop.xtheme.parsing.LayoutPartExtension'¶
- Rows map to
-
class
shoop.xtheme.parsing.
PluginExtension
(environment)[source]¶ Bases:
shoop.xtheme.parsing._PlaceholderManagingExtension
Parser for plugin tags.
Syntax for plugin tag is:
{% plugin <NAME> %}...{% endplugin %}
- The (optional) body of the plugin block is expected to be a Jinja2
AST that can be folded into a constant. Generally this means a
single block of text (
{% raw }
/{% endraw %}
is okay!). - The contents of the body, if set, must be valid TOML markup. The TOML is parsed during Jinja2 parse time into a dict, which in turn is folded into the layout description object. This means only the initial parsing of the template incurs whatever performance hit there is in parsing TOML; the Jinja2 bccache should take care of the rest.
-
parse
(parser)[source]¶ Parse a column or row.
Parameters: parser (jinja2.parser.Parser) – Template parser Returns: A null output node. Return type: jinja2.nodes.Node
-
identifier
= 'shoop.xtheme.parsing.PluginExtension'¶
- The (optional) body of the plugin block is expected to be a Jinja2
AST that can be folded into a constant. Generally this means a
single block of text (
-
shoop.xtheme.rendering.
get_view_config
(context, global_type=False)[source]¶ Get a view configuration object for a Jinja2 rendering context.
Parameters: - context (jinja2.runtime.Context) – Rendering context
- global_type (bool|False) – Boolean indicating whether this is a global type
Returns: View config
Return type:
-
shoop.xtheme.rendering.
render_placeholder
(context, placeholder_name, default_layout=None, template_name=None, global_type=False)[source]¶ Render a placeholder in a given context.
See
PlaceholderRenderer
for argument docs.Returns: Markup Return type: Markup
-
class
shoop.xtheme.rendering.
PlaceholderRenderer
(context, placeholder_name, default_layout=None, template_name=None, global_type=False)[source]¶ Bases:
object
Main class for materializing a placeholder’s contents during template render time.
Parameters: - context (jinja2.runtime.Context) – Rendering context
- placeholder_name (str) – Placeholder name
- default_layout (Layout|dict|None) – Layout or serialized layout (from template configuration)
- template_name (str|None) – The actual template this node was in. Used to figure out whether the placeholder
lives in an
extends
parent, or in a child. - global_type (bool|False) – Boolean indicating whether this is a global placeholder
-
class
shoop.xtheme.resources.
InlineScriptResource
[source]¶ Bases:
str
An inline script resource (a subclass of string).
The contents are rendered inside a
<script>
tag.-
classmethod
from_vars
(var_name, *args, **kwargs)[source]¶ Create an InlineScriptResource assigning an object of variables into a name in the
window
scope.Aside from
var_name
the signature of this function is similar to that ofdict
. Useful for configuration options, etc.Parameters: var_name (str) – The variable to add into global scope Returns: An InlineScriptResource
objectReturn type: InlineScriptResource
-
classmethod
-
class
shoop.xtheme.resources.
InlineMarkupResource
[source]¶ Bases:
str
An inline markup resource (a subclass of string).
The contents are rendered as-is.
-
class
shoop.xtheme.resources.
ResourceContainer
[source]¶ Bases:
object
ResourceContainers deal with storing and rendering injected resources.
A ResourceContainer is injected into rendering contexts by
XthemeTemplate
(akin to howdjango-jinja
‘s Template injectsrequest
andcsrf_token
).-
add_resource
(location, resource)[source]¶ Add a resource into the given location.
Duplicate resources are ignored (and false is returned). Resource injection order is retained.
Parameters: - location (str) – The name of the location. See KNOWN_LOCATIONS.
- resource (str|InlineMarkupResource|InlineScriptResource) – The actual resource. Either an URL string or one of the inline resource classes.
Returns: Success flag.
Return type:
-
-
shoop.xtheme.resources.
inject_resources
(context, content, clean=True)[source]¶ Inject all the resources in the context’s ResourceContainer into appropriate places in the content given.
Parameters: Returns: Possibly modified HTML content
Return type:
-
shoop.xtheme.resources.
get_resource_container
(context)[source]¶ Get a
ResourceContainer
from a rendering context.Parameters: context (jinja2.runtime.Context) – Context Returns: Resource Container Return type: shoop.xtheme.resources.ResourceContainer|None
-
shoop.xtheme.resources.
add_resource
(context, location, resource)[source]¶ Add an Xtheme resource into the given context.
Parameters: - context (jinja2.runtime.Context) – Context
- location (str) – Location string (see KNOWN_LOCATIONS)
- resource (str|InlineMarkupResource|InlineScriptResource) – Resource descriptor (URL or inline markup object)
Returns: Success flag
Return type:
-
class
shoop.xtheme.template_ns.
XthemeNamespace
[source]¶ Bases:
object
A template helper namespace for Xtheme-related functionality.
-
get_view_name
(context)[source]¶ Get the current view’s view name (used for identifying view configurations).
Parameters: context (jinja2.runtime.Context) – Implicit Jinja2 context Returns: View name string Return type: str
-
-
shoop.xtheme.testing.
override_current_theme_class
(theme_class=<object object>)¶ Context manager for overriding the currently active theme class for testing.
An instance of this class is then returned by
get_current_theme
.A falsy value means
None
is returned fromget_current_theme
, which is also useful for testing.Parameters: theme_class (class[Theme]) – A theme class object
-
shoop.xtheme.utils.
join_css_classes
(class_list)[source]¶ Join an iterable of truthy values by spaces, effectively creating a list of CSS classes.
The retval is sorted for cleanliness.
Parameters: class_list (Iterable[str]) – Iterable of classes Returns: String Return type: str
-
shoop.xtheme.utils.
get_html_attrs
(attrs)[source]¶ Flatten a dict into HTML attributes (it’s
django.forms.utils.flatatt
on steroids!).Only truthy keys and values are taken into account; list-like values are flattened with
join_css_classes
Parameters: attrs (dict[str, object]) – Attribute dict Returns: string ready to paste after a HTML tag open. <foo%s>
!Return type: str
-
class
shoop.xtheme.view_config.
ViewConfig
(theme, view_name, draft, global_type=False)[source]¶ Bases:
object
A view configuration.
Contains layout and plugin configuration for all placeholders in a given view.
This class does not directly correspond to a database model; it may act as a container for
SavedViewConfig
objects, and wraps theSavedViewConfig
API.Initialize a view configuration.
Parameters: -
saved_view_config
¶ Get a saved view config model depending on the current parameters.
Returns: A SavedViewConfig object for the current theme/view/draft mode, or None Return type: shoop.xtheme.models.SavedViewConfig|None
-
get_placeholder_layout
(placeholder_name, default_layout=None)[source]¶ Get a Layout object for the given placeholder.
Parameters: - placeholder_name (str) – The name of the placeholder to load.
- default_layout (dict|Layout) – Default layout configuration (either a dict or an actual Layout)
Returns: Layout
Return type:
-
save_default_placeholder_layout
(placeholder_name, layout)[source]¶ Save a default placeholder layout (only if no data for the PH already exists).
Parameters: - placeholder_name (str) – Placeholder name
- layout (Layout|dict) – Layout or layout data
Returns: True if saved
Return type:
-
publish
()[source]¶ Publish this revision of the view configuration as the currently public one.
Returns: Success flag Return type: bool
-
-
class
shoop.xtheme.
Plugin
(config)¶ Bases:
object
A plugin that can be instantiated within a
shoop.xtheme.layout.LayoutCell
.Other plugins should inherit from this class and register themselves in the
xtheme_plugin
provide category.Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
editor_form_class
¶ alias of
GenericPluginForm
-
fields
= []¶
-
get_editor_form_class
()[source]¶ Return the form class for editing this plugin.
The form class should either derive from PluginForm, or at least have a
get_config()
method.Form classes without
fields
are treated the same way as if you’d returnNone
, i.e. no configuration form is presented to the user.Returns: Editor form class Return type: class[forms.Form]|None
-
classmethod
get_plugin_choices
(empty_label=None)[source]¶ Get a sorted list of 2-tuples (identifier and name) of available Xtheme plugins.
Handy for
<select>
boxen.Parameters: empty_label (str|None) – Label for the “empty” choice. If falsy, no empty choice is prepended Returns: List of 2-tuples Return type: Iterable[tuple[str, str]]
-
get_translated_value
(key, default=None, language=None)[source]¶ Get a translated value from the plugin’s configuration.
It’s assumed that translated values are stored in a
{language: data, ...}
dictionary in the plugin configuration blob. This is the protocol thatshoop.xtheme.plugins.forms.TranslatableField
uses.If the configuration blob contains such a dictionary, but it does not contain a translated value in the requested language does not exist, the fallback value, if any, within that dictionary is tried next. Failing that, the
default
value is returned.Parameters: - key (str) – Configuration key
- default – Default value to return when all else fails.
- language (str|None) – Requested language. Defaults to the active language.
Returns: A translated value.
-
identifier
= None¶
-
is_context_valid
(context)[source]¶ Check that the given rendering context is valid for rendering this plugin.
By default, just checks
required_context_variables
.Parameters: context (jinja2.runtime.Context) – Rendering context Returns: True if we should bother trying to render this Return type: bool
-
classmethod
load
(identifier)[source]¶ Get a plugin class based on the identifier from the
xtheme_plugin
provides registry.Parameters: identifier (str) – Plugin class identifier Returns: A plugin class, or None Return type: class[Plugin]|None
-
name
= <django.utils.functional.lazy.<locals>.__proxy__ object>¶
-
render
(context)[source]¶ Return the HTML for a plugin in a given rendering context.
Parameters: context (jinja2.runtime.Context) – Rendering context Returns: String of rendered content. Return type: str
-
required_context_variables
= set()¶
-
-
class
shoop.xtheme.
TemplatedPlugin
(config)¶ Bases:
shoop.xtheme.Plugin
Convenience base class for plugins that just render a “sub-template” with a given context.
Instantiate a Plugin with the given
config
dictionary.Parameters: config (dict) – Dictionary of freeform configuration data -
config_copied_variables
= set()¶
-
engine
= None¶
-
get_context_data
(context)[source]¶ Get a context dictionary from a Jinja2 context.
Parameters: context (jinja2.runtime.Context) – Jinja2 rendering context Returns: Dict of vars Return type: dict[str, object]
-
inherited_variables
= set()¶
-
template_name
= ''¶
-
-
class
shoop.xtheme.
Theme
(settings_obj=None)¶ Bases:
object
Base class for all Xtheme themes.
This class does not directly correspond to a database object; it’s used in the rendering, etc. process.
It does, however, act as a container for a
ThemeSettings
object that contains the actual persisted settings etc.Initialize this theme, with an optional
ThemeSettings
objectParameters: settings_obj (ThemeSettings|None) – A theme settings object for this theme, if one exists. Passing this in will avoid extraneous database queries. -
fields
= []¶
-
get_configuration_form
(form_kwargs)[source]¶ Return a ModelForm instance (model=ThemeSettings) for configuring this theme.
By default, returns a GenericThemeForm (a ModelForm populated from
theme.fields
).Parameters: form_kwargs (dict) – The keyword arguments that should be used for initializing the form Return type: django.forms.ModelForm
-
get_setting
(key, default=None)[source]¶ Get a setting value for this theme.
Parameters: Returns: Setting value
Return type:
-
get_settings
()[source]¶ Get all the currently set settings for the theme as a dict.
Returns: Dict of settings Return type: dict
-
get_view
(view_name)[source]¶ Get an extra view for this theme.
Views may be either normal Django functions or CBVs (or anything that has
as_view()
really). Falsy values are considered “not found”.Parameters: view_name (str) – View name Returns: The extra view, if one exists for the given name. Return type: dict[str, View|callable]|None
-
global_placeholders
= []¶
-
identifier
= None¶
-
name
= ''¶
-
set_settings
(*args, **kwargs)[source]¶ Set a number of settings for this theme.
The arguments are exactly the same as those to
dict
.Note
It’s better to call this once than
set_setting
several times.
-
settings_obj
¶ Get a saved settings model for this theme. If one does not yet exist, an unsaved one is returned.
If one was passed in the ctor, naturally that one is returned.
Return type: shoop.xtheme.models.ThemeSettings
-
template_dir
= None¶
-
-
shoop.xtheme.
get_current_theme
(request=None)¶ Get the currently active theme object.
Parameters: request (HttpRequest|None) – Request, if available Returns: Theme object or None Return type: Theme
-
shoop.xtheme.
get_theme_by_identifier
(identifier, settings_obj=None)¶ Get an instantiated theme by identifier.
Parameters: - identifier (str) – Theme identifier
- settings_obj (shoop.xtheme.models.ThemeSettings) – Optional ThemeSettings object for the theme constructor
Returns: Theme object or None
Return type:
-
shoop.xtheme.
set_current_theme
(identifier)¶ Activate a theme based on identifier.
Parameters: identifier (str) – Theme identifier
-
shoop.xtheme.
templated_plugin_factory
(identifier, template_name, **kwargs)¶ A factory (akin to
modelform_factory
) to quickly create simple plugins.Parameters: - identifier (str) – The unique identifier for the new plugin.
- template_name (str) – The template file path this plugin should render
- kwargs (dict) – Other arguments for the
TemplatedPlugin
/Plugin
classes.
Returns: New
TemplatedPlugin
subclassReturn type: class[TemplatedPlugin]
Submodules¶
shoop.configuration module¶
API for Shoop’s Dynamic Configuration.
Idea of the Dynamic Configuration is to allow storing configuration values similarly as Django settings allows, but in a more flexible way: Dynamic Configuration can be changed with a simple API and there is no need restart the application server after changing a value.
Dynamic configuration values are permanent. Current implementation
stores the values with ConfigurationItem
model into
database, but that may change in the future.
Configuration values are get and set by a key string. There is a global configuration and a shop specific configuration for each shop. Values in shop specific configuration override the values in global configuration.
-
shoop.configuration.
set
(shop, key, value)[source]¶ Set configuration item value for a shop or globally.
If given
shop
isNone
, the value of givenkey
is set globally for all shops. Otherwise sets a shop specific value which overrides the global value in configuration of the specified shop.Parameters: - shop (shoop.core.models.Shop|None) – Shop to set value for, or None to set a global value
- key (str) – Name of the key to set
- value (Any) – Value to set. Note: Must be JSON serializable.
-
shoop.configuration.
get
(shop, key, default=None)[source]¶ Get configuration value by shop and key.
Global configuration can be accessed with
shop=None
.Parameters: - shop (shoop.core.models.Shop|None) – Shop to get configuration value for, or None
- key (str) – Configuration item key
- default (Any) – Default value returned if no value is set for given key (globally or in given shop).
Returns: Configuration value or the default value
Return type: Any
Module contents¶
Shoop Web APIs¶
REST API¶
The Shoop REST API is built on Django REST Framework with additional functionality built on The Provides system 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/cgp_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()