shuup.admin package¶
Subpackages¶
- shuup.admin.breadcrumbs package
- shuup.admin.dashboard package
- shuup.admin.forms package
- shuup.admin.modules package
- Subpackages
- shuup.admin.modules.attributes package
- shuup.admin.modules.categories package
- shuup.admin.modules.contact_groups package
- shuup.admin.modules.contacts package
- shuup.admin.modules.content package
- shuup.admin.modules.currencies package
- shuup.admin.modules.customers_dashboard package
- shuup.admin.modules.demo package
- shuup.admin.modules.manufacturers package
- shuup.admin.modules.media package
- shuup.admin.modules.orders package
- Subpackages
- shuup.admin.modules.orders.views package
- Submodules
- shuup.admin.modules.orders.views.addresses module
- shuup.admin.modules.orders.views.detail module
- shuup.admin.modules.orders.views.edit module
- shuup.admin.modules.orders.views.list module
- shuup.admin.modules.orders.views.log module
- shuup.admin.modules.orders.views.payment module
- shuup.admin.modules.orders.views.refund module
- shuup.admin.modules.orders.views.shipment module
- shuup.admin.modules.orders.views.status module
- Module contents
- shuup.admin.modules.orders.views package
- Submodules
- shuup.admin.modules.orders.json_order_creator module
- shuup.admin.modules.orders.mass_actions module
- shuup.admin.modules.orders.receivers module
- shuup.admin.modules.orders.sections module
- shuup.admin.modules.orders.toolbar module
- shuup.admin.modules.orders.utils module
- Module contents
- Subpackages
- shuup.admin.modules.permission_groups package
- shuup.admin.modules.product_types package
- shuup.admin.modules.products package
- Subpackages
- shuup.admin.modules.products.forms package
- Submodules
- shuup.admin.modules.products.forms.base_forms module
- shuup.admin.modules.products.forms.package_forms module
- shuup.admin.modules.products.forms.parent_forms module
- shuup.admin.modules.products.forms.simple_variation_forms module
- shuup.admin.modules.products.forms.variable_variation_forms module
- Module contents
- shuup.admin.modules.products.views package
- Submodules
- shuup.admin.modules.products.views.delete module
- shuup.admin.modules.products.views.edit module
- shuup.admin.modules.products.views.edit_cross_sell module
- shuup.admin.modules.products.views.edit_media module
- shuup.admin.modules.products.views.edit_package module
- shuup.admin.modules.products.views.edit_parent module
- shuup.admin.modules.products.views.edit_variation module
- shuup.admin.modules.products.views.list module
- shuup.admin.modules.products.views.mass_edit module
- shuup.admin.modules.products.views.toolbars module
- Module contents
- shuup.admin.modules.products.forms package
- Submodules
- shuup.admin.modules.products.mass_actions module
- shuup.admin.modules.products.sections module
- shuup.admin.modules.products.signal_handlers module
- shuup.admin.modules.products.utils module
- Module contents
- Subpackages
- shuup.admin.modules.sales_dashboard package
- shuup.admin.modules.sales_units package
- shuup.admin.modules.sample_data package
- shuup.admin.modules.service_providers package
- shuup.admin.modules.services package
- shuup.admin.modules.settings package
- Subpackages
- Submodules
- shuup.admin.modules.settings.consts module
- shuup.admin.modules.settings.enums module
- shuup.admin.modules.settings.view_settings module
- Module contents
- shuup.admin.modules.shops package
- shuup.admin.modules.suppliers package
- shuup.admin.modules.support package
- shuup.admin.modules.system package
- shuup.admin.modules.taxes package
- shuup.admin.modules.users package
- Module contents
- Subpackages
- shuup.admin.template_helpers package
- shuup.admin.templatetags package
- shuup.admin.utils package
- Submodules
- shuup.admin.utils.bs3_renderers module
- shuup.admin.utils.forms module
- shuup.admin.utils.permissions module
- shuup.admin.utils.picotable module
- shuup.admin.utils.search module
- shuup.admin.utils.str_utils module
- shuup.admin.utils.tour module
- shuup.admin.utils.urls module
- shuup.admin.utils.views module
- shuup.admin.utils.wizard module
- Module contents
- shuup.admin.views package
Submodules¶
shuup.admin.base module¶
-
class
shuup.admin.base.
AdminModule
[source]¶ Bases:
object
-
name
= '_Base_'¶
Return type: dict[str,str]
Return type: list[shuup.admin.base.MenuEntry]
-
get_help_blocks
(request, kind)[source]¶ Parameters: - request (django.http.request.HttpRequest) – Request
- kind (str) – block kind. Currently “setup” or “quicklink”
Return type: list[shuup.admin.views.home.HelpBlock]
-
get_activity
(request, cutoff)[source]¶ Parameters: - cutoff (datetime.datetime) – Cutoff datetime
- request (django.http.request.HttpRequest) – Request
Returns: list[shuup.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
shuup.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
shuup.admin.base.
MenuEntry
(text, url, icon=None, category=None, subcategory=None, ordering=99999, aliases=())[source]¶ Bases:
shuup.admin.base.Resolvable
-
class
shuup.admin.base.
SearchResult
(text, url, icon=None, category=None, is_action=False, relevance=100, target=None)[source]¶ Bases:
shuup.admin.base.Resolvable
-
class
shuup.admin.base.
Notification
(text, title=None, url=None, kind='info', dismissal_url=None, datetime=None)[source]¶ Bases:
shuup.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
shuup.admin.base.
Activity
(datetime, text, url=None)[source]¶ Bases:
shuup.admin.base.Resolvable
-
class
shuup.admin.base.
Section
[source]¶ Bases:
object
Subclass this and add the class to the admin_*_section provide list (e.g.
admin_order_section
) to show a custom section on the specified model object’s admin detail page.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¶
-
static
visible_for_object
(obj)[source]¶ Returns whether this sections must be visible for the provided object (e.g.
order
) :type model object: e.g. shuup.core.models.Order :return whether this section must be shown in order section list, defaults to false :rtype: bool
-
static
get_context_data
(obj)[source]¶ Returns additional information to be used in the template
To fetch this data in the template, you must first add it to your request’s context
- e.g. `context[admin_order_section.identifier] =
admin_order_section.get_context_data(self.object)`
:return additional context data :rtype: object|None
-
-
class
shuup.admin.base.
OrderSection
[source]¶ Bases:
shuup.admin.base.Section
Deprecated use Section instead
shuup.admin.currencybound module¶
-
class
shuup.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
¶
-
shuup.admin.error_handlers module¶
shuup.admin.form_modifier module¶
-
class
shuup.admin.form_modifier.
FormModifier
[source]¶ Bases:
object
-
get_extra_fields
(object=None)[source]¶ Extra fields for creation view.
Parameters: object (django.db.models.Model) – Object 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 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 (django.forms.Form) – Form that is currently cleaned Return type: None
-
form_valid_hook
(form, object)[source]¶ Extra form valid handler for creation view.`
Parameters: - form (django.forms.Form) – Form that is currently handled
- object (django.db.models.Model) – object linked to form
Return type:
-
shuup.admin.form_part module¶
-
class
shuup.admin.form_part.
TemplatedFormDef
(name, form_class, template_name, required=True, kwargs=None)[source]¶
shuup.admin.module_registry module¶
-
shuup.admin.module_registry.
get_admin_modules
()[source]¶ Return type: list[shuup.admin.base.AdminModule]
-
shuup.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
shuup.admin.settings module¶
-
shuup.admin.settings.
SHUUP_SETUP_WIZARD_PANE_SPEC
= []¶ Spec which defines a list of Wizard Panes to be shown in Shuup Admin for Shuup initialization and configuration.
Panes must be subclasses of
shuup.admin.views.WizardPane
.
-
shuup.admin.settings.
SHUUP_GET_ADMIN_MODULES_SPEC
= 'shuup.admin.module_registry.get_admin_modules'¶ Spec which defines a function that loads and return discovered admin modules. This function should return a list of
shuup.admin.base.AdminModule
shuup.admin.signals module¶
shuup.admin.toolbar module¶
-
class
shuup.admin.toolbar.
BaseActionButton
(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default', required_permissions=(), identifier=None)[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)
- required_permissions (Iterable[str]) – Optional iterable of permission strings
-
base_css_classes
= ('btn',)¶
-
class
shuup.admin.toolbar.
URLActionButton
(url, **kwargs)[source]¶ Bases:
shuup.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
shuup.admin.toolbar.
SettingsActionButton
(url, **kwargs)[source]¶ Bases:
shuup.admin.toolbar.URLActionButton
A generic settings button meant to be used across many modules
-
class
shuup.admin.toolbar.
NewActionButton
(url, **kwargs)[source]¶ Bases:
shuup.admin.toolbar.URLActionButton
An URL button with sane “new” visual semantics
-
class
shuup.admin.toolbar.
JavaScriptActionButton
(onclick, **kwargs)[source]¶ Bases:
shuup.admin.toolbar.BaseActionButton
An action button that uses
onclick
for action dispatch.
-
class
shuup.admin.toolbar.
PostActionButton
(post_url=None, name=None, value=None, form_id=None, confirm=None, **kwargs)[source]¶ Bases:
shuup.admin.toolbar.BaseActionButton
An action button that renders as a button POSTing a form containing
name`=`value
topost_url
.
-
class
shuup.admin.toolbar.
DropdownActionButton
(items, split_button=None, **kwargs)[source]¶ Bases:
shuup.admin.toolbar.BaseActionButton
An action button with a chevron button to open a dropdown menu.
-
base_css_classes
= ('btn', 'dropdown-toggle')¶
-
-
class
shuup.admin.toolbar.
DropdownItem
(url='#', onclick=None, **kwargs)[source]¶ Bases:
shuup.admin.toolbar.BaseActionButton
An item to be shown in a
DropdownActionButton
.-
base_css_classes
= ()¶
-
-
class
shuup.admin.toolbar.
PostActionDropdownItem
(**kwargs)[source]¶ Bases:
shuup.admin.toolbar.PostActionButton
A POST action item to be shown in a
DropdownActionButton
.-
base_css_classes
= ()¶
-
-
class
shuup.admin.toolbar.
DropdownDivider
(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default', required_permissions=(), identifier=None)[source]¶ Bases:
shuup.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)
- required_permissions (Iterable[str]) – Optional iterable of permission strings
-
base_css_classes
= ()¶
-
class
shuup.admin.toolbar.
DropdownHeader
(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='btn-default', required_permissions=(), identifier=None)[source]¶ Bases:
shuup.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)
- required_permissions (Iterable[str]) – Optional iterable of permission strings
-
base_css_classes
= ()¶
-
shuup.admin.toolbar.
get_default_edit_toolbar
(view_object, save_form_id, discard_url=None, delete_url=None, with_split_save=True, toolbar=None, required_permissions=())[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:
shuup.admin.urls module¶
Module contents¶
-
class
shuup.admin.
ShuupAdminAppConfig
(*args, **kwargs)[source]¶ Bases:
shuup.apps.AppConfig
-
name
= 'shuup.admin'¶
-
verbose_name
= 'Shuup Admin'¶
-
label
= 'shuup_admin'¶
-
required_installed_apps
= ['bootstrap3']¶
-
provides
= {'admin_product_section': ['shuup.admin.modules.products.sections:ProductOrdersSection'], 'service_provider_admin_form': ['shuup.admin.modules.service_providers.forms:CustomCarrierForm', 'shuup.admin.modules.service_providers.forms:CustomPaymentProcessorForm'], 'payment_processor_wizard_form_def': ['shuup.admin.modules.service_providers.wizard_form_defs:ManualPaymentWizardFormDef'], 'service_behavior_component_form': ['shuup.admin.modules.services.forms:FixedCostBehaviorComponentForm', 'shuup.admin.modules.services.forms:WaivingCostBehaviorComponentForm', 'shuup.admin.modules.services.forms:WeightLimitsBehaviorComponentForm', 'shuup.admin.modules.services.forms:GroupAvailabilityBehaviorComponentForm', 'shuup.admin.modules.services.forms.StaffOnlyBehaviorComponentForm', 'shuup.admin.modules.services.forms.OrderTotalLimitBehaviorComponentForm', 'shuup.admin.modules.services.forms.CountryLimitBehaviorComponentForm'], 'admin_module': ['shuup.admin.modules.system:SystemModule', 'shuup.admin.modules.products:ProductModule', 'shuup.admin.modules.product_types:ProductTypeModule', 'shuup.admin.modules.media:MediaModule', 'shuup.admin.modules.orders:OrderModule', 'shuup.admin.modules.taxes:TaxModule', 'shuup.admin.modules.categories:CategoryModule', 'shuup.admin.modules.contacts:ContactModule', 'shuup.admin.modules.contact_groups:ContactGroupModule', 'shuup.admin.modules.currencies:CurrencyModule', 'shuup.admin.modules.customers_dashboard:CustomersDashboardModule', 'shuup.admin.modules.permission_groups:PermissionGroupModule', 'shuup.admin.modules.users:UserModule', 'shuup.admin.modules.service_providers:ServiceProviderModule', 'shuup.admin.modules.services:PaymentMethodModule', 'shuup.admin.modules.services:ShippingMethodModule', 'shuup.admin.modules.attributes:AttributeModule', 'shuup.admin.modules.sales_units:DisplayUnitModule', 'shuup.admin.modules.sales_units:SalesUnitModule', 'shuup.admin.modules.sales_dashboard:SalesDashboardModule', 'shuup.admin.modules.shops:ShopModule', 'shuup.admin.modules.demo:DemoModule', 'shuup.admin.modules.manufacturers:ManufacturerModule', 'shuup.admin.modules.suppliers:SupplierModule', 'shuup.admin.modules.support:ShuupSupportModule', 'shuup.admin.modules.sample_data:SampleDataAdminModule', 'shuup.admin.modules.settings.SettingsModule'], 'admin_contact_section': ['shuup.admin.modules.contacts.sections:BasicInfoContactSection', 'shuup.admin.modules.contacts.sections:AddressesContactSection', 'shuup.admin.modules.contacts.sections:OrdersContactSection', 'shuup.admin.modules.contacts.sections:MembersContactSection'], 'service_behavior_component_form_part': ['shuup.admin.modules.services.weight_based_pricing.WeightBasedPricingFormPart'], 'admin_shop_form_part': ['shuup.admin.modules.settings.form_parts.OrderConfigurationFormPart'], 'admin_order_toolbar_action_item': ['shuup.admin.modules.orders.toolbar:CreatePaymentAction', 'shuup.admin.modules.orders.toolbar:SetPaidAction', 'shuup.admin.modules.orders.toolbar:CreateShipmentAction', 'shuup.admin.modules.orders.toolbar:CreateRefundAction', 'shuup.admin.modules.orders.toolbar:EditAddresses'], 'carrier_wizard_form_def': ['shuup.admin.modules.service_providers.wizard_form_defs:ManualShippingWizardFormDef'], 'admin_order_section': ['shuup.admin.modules.orders.sections:PaymentOrderSection', 'shuup.admin.modules.orders.sections:LogEntriesOrderSection', 'shuup.admin.modules.orders.sections:ShipmentSection', 'shuup.admin.modules.orders.sections:AdminCommentSection']}¶
-