shuup.admin package

Subpackages

Submodules

shuup.admin.base module

class shuup.admin.base.AdminModule[source]

Bases: object

name = '_Base_'
breadcrumbs_menu_entry = None
get_urls()[source]
Return type:list[django.urls.RegexURLPattern]
get_menu_category_icons()[source]
Return type:dict[str,str]
get_menu_entries(request)[source]
Return type:list[shuup.admin.base.MenuEntry]
get_search_results(request, query)[source]
Return type:list[shuup.admin.base.SearchResult]
get_dashboard_blocks(request)[source]
Return type:list[shuup.admin.dashboard.DashboardBlock]
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_required_permissions() → typing.Iterable[str][source]

Returns a list of required permissions for this module to be enabled :rtype: list[str]

get_extra_permissions() → typing.Iterable[str][source]

Define custom extra permissions for admin module for option to limit certain parts of the admin module based on per user permission string. Should return unique list permission strings across the installation to prevent unwanted side effects.

Return type:list[str]
get_permissions_help_texts() → typing.Dict[str, str][source]

Returns a dictionary where the keys is the permission identifier and the value is a help text that can help the user to understand where the permissions is used and how it works.

get_notifications(request)[source]
Return type:list[shuup.admin.base.Notification]
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, shop=None)[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”.
  • shop (shuup.core.models.Shop|None) – The shop that owns the resource.
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.BaseMenuEntry[source]

Bases: shuup.admin.base.Resolvable

identifier = None
name = None
icon = ''
is_hidden = False
ordering = -1
entries = []
id

Value containing only hexadecimal digits, we can use this safely in html code.

has_entries
to_dict()[source]
get(item, default=None)[source]
class shuup.admin.base.MenuEntry(text, url, icon=None, category=None, ordering=99999, aliases=(), **kwargs)[source]

Bases: shuup.admin.base.BaseMenuEntry

identifier
name
get_search_query_texts()[source]
get_text(request) → str[source]
get_badge(request) → typing.Union[typing.Dict, NoneType][source]

Should return a dictionary with the information of the badge or None: ```

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.MenuEntry.get_badge, line 1); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.MenuEntry.get_badge, line 1); backlink

Inline interpreted text or phrase reference start-string without end-string.

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.MenuEntry.get_badge, line 3)

Unexpected indentation.
{
“tag”: “info|success|danger|warning”, “value”: “my value”

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.MenuEntry.get_badge, line 6)

Definition list ends without a blank line; unexpected unindent.

}

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.MenuEntry.get_badge, line 7)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.MenuEntry.get_badge, line 7); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.MenuEntry.get_badge, line 7); backlink

Inline interpreted text or phrase reference start-string without end-string.
class shuup.admin.base.SearchResult(text, url, icon=None, category=None, is_action=False, relevance=100, target=None)[source]

Bases: shuup.admin.base.Resolvable

to_json()[source]
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 unique. name the section caption. icon the section icon. template the section template file. extra_js the section extra javascript template file, set a file which contains js code inside a <script> tag. order the order.

identifier = ''
name = ''
icon = ''
template = ''
extra_js = ''
order = 0
classmethod visible_for_object(obj, request)[source]

Returns whether this sections must be visible for the provided object (e.g. order).

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.Section.visible_for_object, line 5)

Field list ends without a blank line; unexpected unindent.

:return whether this section must be shown in order section list, defaults to false :rtype: bool

classmethod get_context_data(obj, request)[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] =

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.Section.get_context_data, line 6); backlink

Inline interpreted text or phrase reference start-string without end-string.

admin_order_section.get_context_data(self.object)`

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/base.py:docstring of shuup.admin.base.Section.get_context_data, line 10)

Field list ends without a blank line; unexpected unindent.

:return additional context data :rtype: object|None

shuup.admin.browser_config module

class shuup.admin.browser_config.BaseBrowserConfigProvider[source]

Bases: object

classmethod get_browser_urls(request, **kwargs)[source]
classmethod get_gettings(request, **kwargs)[source]
class shuup.admin.browser_config.DefaultBrowserConfigProvider[source]

Bases: shuup.admin.browser_config.BaseBrowserConfigProvider

classmethod get_browser_urls(request, **kwargs)[source]
classmethod get_gettings(request, **kwargs)[source]

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 by module_registry.register (which is called at import because admin.urls calls get_module_urls at import).

currency

shuup.admin.error_handlers module

class shuup.admin.error_handlers.AdminPageErrorHandler[source]

Bases: shuup.core.error_handling.ErrorPageHandler

Page Error handler for Shuup Admin

classmethod can_handle_error(request, error_status)[source]
classmethod handle_error(request, error_status)[source]

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.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/form_modifier.py:docstring of shuup.admin.form_modifier.FormModifier.get_extra_fields, line 6)

Field list ends without a blank line; unexpected unindent.

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 call add_error to add errors to form or modify the form.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:

None

class shuup.admin.form_modifier.ModifiableFormMixin[source]

Bases: object

form_modifier_provide_key = None
clean()[source]
class shuup.admin.form_modifier.ModifiableViewMixin[source]

Bases: object

add_extra_fields(form, object=None)[source]
get_form(form_class=None)[source]
form_valid_hook(form, object)[source]
form_valid(form)[source]

shuup.admin.form_part module

class shuup.admin.form_part.TemplatedFormDef(name, form_class, template_name, required=True, kwargs=None)[source]

Bases: shuup.utils.form_group.FormDef

class shuup.admin.form_part.FormPart(request, object=None)[source]

Bases: object

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

Bases: object

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

Bases: object

request = None
object = None
save_form_parts(form)[source]

shuup.admin.menu module

shuup.admin.menu.extend_main_menu(menu)[source]
shuup.admin.menu.customize_menu(entries, request)[source]

Merge system menu with customized admin menu

shuup.admin.menu.get_menu_entry_categories(request)[source]

shuup.admin.middleware module

class shuup.admin.middleware.ShuupAdminMiddleware(get_response=None)[source]

Bases: django.utils.deprecation.MiddlewareMixin

Handle Shuup Admin specific tasks for each request and response.

  • Sets the current shop from the request request.shop : shuup.core.models.Shop

    System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/middleware.py:docstring of shuup.admin.middleware.ShuupAdminMiddleware, line 5)

    Unexpected indentation.

    Currently active Shop.

process_view(request, view_func, view_args, view_kwargs)[source]

shuup.admin.module_registry module

shuup.admin.module_registry.register(module_class)[source]
shuup.admin.module_registry.discover()[source]
shuup.admin.module_registry.get_admin_modules()[source]
Return type:list[shuup.admin.base.AdminModule]
shuup.admin.module_registry.get_modules()[source]
Return type:list[shuup.admin.base.AdminModule]
shuup.admin.module_registry.get_module_urls()[source]
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 during Shuup’s 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 returns discovered admin modules. This function should return a list of shuup.admin.base.AdminModule.

shuup.admin.settings.SHUUP_ADMIN_SHOP_PROVIDER_SPEC = 'shuup.admin.shop_provider.AdminShopProvider'

Spec which defines the Shop provider. The shop provider is the interface responsible for fetching and setting the active shop in the admin module.

shuup.admin.settings.SHUUP_ADMIN_MERCHANT_DOCS_PAGE = 'https://shuup-guide.readthedocs.io/en/latest/'

URL address to Shuup Merchant Documentation and Guide. The URL must end with a slash.

The minimum number of characters required to start a search.

shuup.admin.settings.SHUUP_ADMIN_SUPPLIER_PROVIDER_SPEC = 'shuup.admin.supplier_provider.DefaultSupplierProvider'

Spec that defines the Supplier Provider for a given request.

shuup.admin.settings.SHUUP_ADMIN_DATE_INPUT_FORMAT = 'Y-m-d'

The input format to be used in date pickers.

shuup.admin.settings.SHUUP_ADMIN_DATETIME_INPUT_FORMAT = 'Y-m-d H:i'

The input format to be used in datetime pickers.

shuup.admin.settings.SHUUP_ADMIN_TIME_INPUT_FORMAT = 'H:i'

The input format to be used in time pickers.

shuup.admin.settings.SHUUP_ADMIN_DATETIME_INPUT_STEP = 15

The input step to be used for time pickers.

shuup.admin.settings.SHUUP_ALWAYS_ACTIVE_MENU_CATEGORY_IDENTIFIERS = []

Menu category identifiers that should always activate the menu item. Useful in case there is a need to always open certain menus.

shuup.admin.settings.SHUUP_ADMIN_NAVIGATION_GET_FRONT_URL_SPEC = 'shuup.admin.utils.urls.get_front_url'

Get front URL for admin panel navigation bar. Can be useful for example to override a custom domain logic when admin panel is used from the shared marketplace URL.

shuup.admin.settings.SHUUP_ADMIN_LOAD_SELECT_OBJECTS_ASYNC = {'categories': True, 'suppliers': True}

Indicates which objects select fields should load options asynchronously.

When enabled, fields will load options through AJAX requests instead of generating them during the initial rendering the page. For enviroments with a huge amount of options in their fields, like categories, it is best to have this enabled.

When disabled, the options will be generated during the first page load.

shuup.admin.settings.SHUUP_ADMIN_AUTH_FORM_SPEC = 'shuup.admin.forms.EmailAuthenticationForm'

Indicates the authentication form class, which should be used in login views inside Admin.

shuup.admin.settings.SHUUP_ADMIN_LOGIN_AS_REDIRECT_VIEW = 'shuup:index'

To which view redirect impersonator when login as regular user

shuup.admin.settings.SHUUP_ADMIN_LOGIN_AS_STAFF_REDIRECT_VIEW = 'shuup_admin:dashboard'

To which view redirect impersonator when login as staff

shuup.admin.settings.SHUUP_ADMIN_REQUIRE_SHIPPING_METHOD_AT_ORDER_CREATOR = True

Whether to require shipping method at admin order creator/edit

shuup.admin.settings.SHUUP_ADMIN_REQUIRE_PAYMENT_METHOD_AT_ORDER_CREATOR = True

Whether to require payment method at admin order creator/edit

shuup.admin.settings.SHUUP_ADMIN_ALLOW_HTML_IN_PRODUCT_DESCRIPTION = True

Whether to allow vendors and staff to use a rich text editor and HTML for product descriptions. If this is False, only a allow simple text field and sanitize all HTML from it.

shuup.admin.settings.SHUUP_ADMIN_ALLOW_HTML_IN_VENDOR_DESCRIPTION = True

Whether to allow vendors to use a rich text editor and HTML for their profile descriptions. If this is False, only a allow simple text field and sanitize all HTML from it.

shuup.admin.settings.SHUUP_GET_MEDIA_FOLDER_FROM_FOLDER = 'shuup.admin.utils.media_folder_from_folder'

The method used to get the media folder from the folder. The relationship between media folder and folder is a foregin key from the mediafolder to the folder. Alltho this allows many media folder to be linked a folder we only have one media folder per folder. If the use case change we can change this setting to get the media folder from the folder.

shuup.admin.settings.SHUUP_ADMIN_PRODUCT_CLONER = 'shuup.admin.utils.product.ProductCloner'

Spec that indicates the product cloner object

shuup.admin.shop_provider module

class shuup.admin.shop_provider.AdminShopProvider[source]

Bases: object

get_shop(request)[source]
set_shop(request, shop=None)[source]
unset_shop(request)[source]
shuup.admin.shop_provider.get_shop_provider()[source]
shuup.admin.shop_provider.get_shop(request)[source]
shuup.admin.shop_provider.set_shop(request, shop=None)[source]
shuup.admin.shop_provider.unset_shop(request)[source]

shuup.admin.signal_handling module

shuup.admin.signal_handling.on_user_groups_change(instance, action, model, **kwargs)[source]

shuup.admin.signals module

shuup.admin.supplier_provider module

class shuup.admin.supplier_provider.DefaultSupplierProvider[source]

Bases: object

classmethod get_supplier(request, **kwargs)[source]
shuup.admin.supplier_provider.get_supplier(request, **kwargs)[source]

shuup.admin.toolbar module

class shuup.admin.toolbar.BaseToolbarButtonProvider[source]

Bases: object

classmethod get_buttons_for_view(view)[source]

Implement this method to add custom buttons to a view’s toolbar

You can check the view attributes before returning buttons. In case you need to access the request, get it from the view: view.request. You can also access the view object when that is available:

``` if getattr(view, “object”, None):

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.BaseToolbarButtonProvider.get_buttons_for_view, line 7); backlink

Inline literal start-string without end-string.

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.BaseToolbarButtonProvider.get_buttons_for_view, line 9)

Unexpected indentation.
yield JavaScriptActionButton(onclick=”window.doSomething()”, text=”Do Something”)

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.BaseToolbarButtonProvider.get_buttons_for_view, line 10)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.BaseToolbarButtonProvider.get_buttons_for_view, line 10); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.BaseToolbarButtonProvider.get_buttons_for_view, line 10); backlink

Inline interpreted text or phrase reference start-string without end-string.
Parameters:django.views.View (view) – the view object to add the toolbar.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.BaseToolbarButtonProvider.get_buttons_for_view, line 13)

Field list ends without a blank line; unexpected unindent.

:rtype iterator|list

class shuup.admin.toolbar.BaseActionButton(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='', 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', '')
render(request)[source]

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

render_label()[source]
get_computed_class()[source]
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.
render(request)[source]
class shuup.admin.toolbar.SettingsActionButton(url, **kwargs)[source]

Bases: shuup.admin.toolbar.URLActionButton

A generic settings button meant to be used across many modules

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

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

Parameters:model – Model class
Return type:shuup.admin.toolbar.SettingsActionButton|None
class shuup.admin.toolbar.NewActionButton(url, **kwargs)[source]

Bases: shuup.admin.toolbar.URLActionButton

An URL button with sane “new” visual semantics

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

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

Parameters:model – Model class
Return type:shuup.admin.toolbar.NewActionButton|None
class shuup.admin.toolbar.JavaScriptActionButton(onclick, **kwargs)[source]

Bases: shuup.admin.toolbar.BaseActionButton

An action button that uses onclick for action dispatch.

base_css_classes = ('btn', 'btn-default')
render(request)[source]
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 to post_url.

render(request)[source]
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')
render_dropdown(request)[source]
render(request)[source]
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 = ()
render(request)[source]
static visible_for_object(object)[source]

Used when dropdown item is added through provides

:return whether this item must be shown :rtype: bool

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 = ('dropdown-item', '')
render(request)[source]
static visible_for_object(object)[source]

Used when dropdown item is added through provides

:return whether this item must be shown :rtype: bool

class shuup.admin.toolbar.DropdownDivider(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='', 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 = ()
render(request)[source]
class shuup.admin.toolbar.DropdownHeader(text='', icon=None, disable_reason=None, tooltip=None, extra_css_class='', 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 = ()
render(request)[source]
class shuup.admin.toolbar.ButtonGroup[source]

Bases: list

render(request)[source]
class shuup.admin.toolbar.Toolbar(*args, **kwargs)[source]

Bases: list

Toolbar for admin views

Add buttons (subclasses of BaseActionButton) to the toolbar through toolbar.append(button) method.

A toolbar can be created for a given View using Toolbar.for_view(view_instance) class method. This method will create an empty toolbar and it will be populated using button providers that are loaded using provides. Views which have the toolbar_buttons_provider_key attribute indicate that buttons should be added to the toolbar using that provide key, e.g:

in your view.py: ``` class MyView(View):

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 11); backlink

Inline literal start-string without end-string.

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 14)

Unexpected indentation.
toolbar_buttons_provider_key = ‘my_view_toolbar_provider_key’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 15)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 15); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 15); backlink

Inline interpreted text or phrase reference start-string without end-string.

in your apps.py: ``` class AppConfig(shuup.apps.AppConfig):

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 17); backlink

Inline literal start-string without end-string.

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 20)

Unexpected indentation.
provides = {
“my_view_toolbar_provider_key”: [
“myapp.toolbar:MyViewToolbarButtonProvider”

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 23)

Definition list ends without a blank line; unexpected unindent.

]

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 24)

Definition list ends without a blank line; unexpected unindent.

}

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 25)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 25); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 25); backlink

Inline interpreted text or phrase reference start-string without end-string.

in your toolbar.py: ``` class MyViewToolbarButtonProvider(BaseToolbarButtonProvider):

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 27); backlink

Inline literal start-string without end-string.

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 30)

Unexpected indentation.

@classmethod def get_buttons_for_view(cls, view):

System Message: ERROR/3 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 32)

Unexpected indentation.
if getattr(view, “object”, None) and isinstance(view.object, Product):
yield JavaScriptActionButton(onclick=”window.doSomething()”, text=”Do Something”)

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 34)

Block quote ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 34); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/shuup/checkouts/latest/shuup/admin/toolbar.py:docstring of shuup.admin.toolbar.Toolbar, line 34); backlink

Inline interpreted text or phrase reference start-string without end-string.

You can also provide buttons to the tollbar of any view using the admin_toolbar_button_provider provide key.

render(request)[source]
render_to_string(request)[source]
classmethod for_view(view)[source]
shuup.admin.toolbar.try_reverse(viewname, **kwargs)[source]
shuup.admin.toolbar.get_discard_button(discard_url)[source]
shuup.admin.toolbar.get_save_as_copy_button(object, copy_url)[source]
shuup.admin.toolbar.get_default_edit_toolbar(view_object, save_form_id, discard_url=None, delete_url=None, copy_url=None, with_split_save=True, with_save_as_copy=False, 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:

Toolbar

shuup.admin.urls module

shuup.admin.urls.login(request, **kwargs)[source]
shuup.admin.urls.get_urls()[source]

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_form_part': ['shuup.admin.modules.products.views.edit.ProductBaseFormPart', 'shuup.admin.modules.products.views.edit.ShopProductFormPart', 'shuup.admin.modules.products.views.edit.ProductAttributeFormPart', 'shuup.admin.modules.products.views.edit.ProductImageMediaFormPart', 'shuup.admin.modules.products.views.edit.ProductMediaFormPart'], 'admin_attribute_form_part': ['shuup.admin.modules.attributes.form_parts.AttributeBaseFormPart', 'shuup.admin.modules.attributes.form_parts.AttributeChoiceOptionsFormPart'], '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.orders:OrderStatusModule', 'shuup.admin.modules.taxes:TaxModule', 'shuup.admin.modules.categories:CategoryModule', 'shuup.admin.modules.contacts:ContactModule', 'shuup.admin.modules.contact_groups:ContactGroupModule', 'shuup.admin.modules.contact_group_price_display:ContactGroupPriceDisplayModule', '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.manufacturers:ManufacturerModule', 'shuup.admin.modules.suppliers:SupplierModule', 'shuup.admin.modules.support:ShuupSupportModule', 'shuup.admin.modules.settings.SettingsModule', 'shuup.admin.modules.labels:LabelsModule', 'shuup.admin.modules.menu:YourAdminMenuModule', 'shuup.admin.modules.menu:SuperUserAdminMenuModule', 'shuup.admin.modules.menu:StaffAdminMenuModule', 'shuup.admin.modules.menu:SupplierAdminMenuModule'], 'admin_shop_form_part': ['shuup.admin.modules.settings.form_parts.OrderConfigurationFormPart'], 'service_provider_admin_form': ['shuup.admin.modules.service_providers.forms:CustomCarrierForm', 'shuup.admin.modules.service_providers.forms:CustomPaymentProcessorForm'], 'carrier_wizard_form_def': ['shuup.admin.modules.service_providers.wizard_form_defs:ManualShippingWizardFormDef'], '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'], 'service_behavior_component_form_part': ['shuup.admin.modules.services.weight_based_pricing.WeightBasedPricingFormPart'], 'admin_order_section': ['shuup.admin.modules.orders.sections:BasicDetailsOrderSection', 'shuup.admin.modules.orders.sections:PaymentOrderSection', 'shuup.admin.modules.orders.sections:LogEntriesOrderSection', 'shuup.admin.modules.orders.sections:ShipmentSection', 'shuup.admin.modules.orders.sections:AdminCommentSection'], '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'], 'admin_product_section': ['shuup.admin.modules.products.sections:ProductOrdersSection'], 'admin_order_toolbar_action_item': ['shuup.admin.modules.orders.toolbar:CreatePaymentAction', 'shuup.admin.modules.orders.toolbar:SetPaidAction', 'shuup.admin.modules.orders.toolbar:CreateRefundAction', 'shuup.admin.modules.orders.toolbar:EditAddresses'], 'admin_model_url_resolver': ['shuup.admin.utils.urls.get_model_url'], 'admin_browser_config_provider': ['shuup.admin.browser_config:DefaultBrowserConfigProvider'], 'admin_supplier_form_part': ['shuup.admin.modules.suppliers.form_parts.SupplierBaseFormPart', 'shuup.admin.modules.suppliers.form_parts.SupplierContactAddressFormPart'], 'user_list_mass_actions_provider': ['shuup.admin.modules.users.mass_actions.UserMassActionProvider']}
ready()[source]