shuup.admin.modules.products.views package

Submodules

shuup.admin.modules.products.views.copy module

class shuup.admin.modules.products.views.copy.ProductCopyView(**kwargs)[source]

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of ShopProduct

context_object_name = 'product'
product_listing_names = ['products']
get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_listing_product_kinds_values()[source]
get_success_url(copied_shop_product: ShopProduct)[source]
get(request, *args, **kwargs)[source]

shuup.admin.modules.products.views.delete module

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

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of ShopProduct

context_object_name = 'product'
product_listing_names = ['products']
get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_listing_product_kinds_values()[source]
get(request, *args, **kwargs)[source]
post(request, *args, **kwargs)[source]

shuup.admin.modules.products.views.edit module

class shuup.admin.modules.products.views.edit.ProductBaseFormPart(request, object=None)[source]

Bases: FormPart

priority: int = -1000
get_form_defs()[source]
form_valid(form_group)[source]
get_sku()[source]
get_initial()[source]
class shuup.admin.modules.products.views.edit.ShopProductFormPart(request, **kwargs)[source]

Bases: FormPart

priority: int = -900
__init__(request, **kwargs)[source]
get_form_defs()[source]
form_valid(form)[source]
get_initial()[source]
has_perm()[source]
class shuup.admin.modules.products.views.edit.ProductAttributeFormPart(request, object=None)[source]

Bases: FormPart

priority: int = -800
get_form_defs()[source]
form_valid(form)[source]
class shuup.admin.modules.products.views.edit.BaseProductMediaFormPart(request, object=None)[source]

Bases: FormPart

get_form_defs()[source]
form_valid(form)[source]
class shuup.admin.modules.products.views.edit.ProductMediaFormPart(request, object=None)[source]

Bases: BaseProductMediaFormPart

name = 'media'
priority: int = -700
formset

alias of ProductMediaFormSet

class shuup.admin.modules.products.views.edit.ProductImageMediaFormPart(request, object=None)[source]

Bases: BaseProductMediaFormPart

name = 'images'
priority: int = -600
formset

alias of ProductImageMediaFormSet

class shuup.admin.modules.products.views.edit.ProductEditView(**kwargs)[source]

Bases: SaveFormPartsMixin, FormPartsViewMixin, CreateOrUpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of ShopProduct

context_object_name = 'product'
template_name = 'shuup/admin/products/edit.jinja'
base_form_part_classes: Any | Any = []
form_part_class_provide_key: str | None = 'admin_product_form_part'
add_form_errors_as_messages = True
product_listing_names = ['products']
get_listing_product_kinds_values()[source]
get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

form_valid(form)[source]

If the form is valid, save the associated model.

get_toolbar()[source]
get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

shuup.admin.modules.products.views.edit_cross_sell module

class shuup.admin.modules.products.views.edit_cross_sell.ProductCrossSellForm(**kwargs)[source]

Bases: ModelForm

class Meta[source]

Bases: object

model

alias of ProductCrossSell

fields = ('product2', 'weight', 'type')
__init__(**kwargs)[source]
save(commit=True)[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

base_fields = {'product2': <django.forms.models.ModelChoiceField object>, 'type': <enumfields.forms.EnumChoiceField object>, 'weight': <django.forms.fields.IntegerField object>}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

class shuup.admin.modules.products.views.edit_cross_sell.ProductCrossSellFormSet(*args, **kwargs)[source]

Bases: BaseModelFormSet

validate_min = False
min_num = 0
validate_max = False
max_num = 1000
absolute_max = 1000
model

alias of ProductCrossSell

can_delete = True
can_order = False
extra = 5
__init__(*args, **kwargs)[source]
form(**kwargs)[source]
class shuup.admin.modules.products.views.edit_cross_sell.ProductCrossSellEditView(**kwargs)[source]

Bases: UpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

model

alias of Product

template_name = 'shuup/admin/products/edit_cross_sell.jinja'
context_object_name = 'product'
form_class

alias of ProductCrossSellFormSet

get_breadcrumb_parents()[source]
get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

form_valid(form)[source]

If the form is valid, save the associated model.

shuup.admin.modules.products.views.edit_media module

class shuup.admin.modules.products.views.edit_media.ProductMediaForm(**kwargs)[source]

Bases: MultiLanguageModelForm

class Meta[source]

Bases: object

model

alias of ProductMedia

fields = ('shops', 'kind', 'file', 'external_url', 'ordering', 'enabled', 'public', 'purchased', 'title', 'description')
__init__(**kwargs)[source]
pre_master_save(instance)[source]
base_fields = {'description': <django.forms.fields.CharField object>, 'enabled': <django.forms.fields.BooleanField object>, 'external_url': <django.forms.fields.URLField object>, 'file': <filer.fields.file.AdminFileFormField object>, 'kind': <enumfields.forms.EnumChoiceField object>, 'ordering': <django.forms.fields.IntegerField object>, 'public': <django.forms.fields.BooleanField object>, 'purchased': <django.forms.fields.BooleanField object>, 'shops': <django.forms.models.ModelMultipleChoiceField object>, 'title': <django.forms.fields.CharField object>}
declared_fields = {'description': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

class shuup.admin.modules.products.views.edit_media.ProductMediaFormSet(*args, **kwargs)[source]

Bases: 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
__init__(*args, **kwargs)[source]
form(**kwargs)[source]
class shuup.admin.modules.products.views.edit_media.ProductMediaEditView(**kwargs)[source]

Bases: 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 = 'shuup/admin/products/edit_media.jinja'
context_object_name = 'product'
form_class

alias of ProductMediaForm

get_breadcrumb_parents()[source]
get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

form_valid(form)[source]

If the form is valid, save the associated model.

class shuup.admin.modules.products.views.edit_media.ProductMediaBulkAdderView(**kwargs)[source]

Bases: View

Adds media in bulk to a pre-existing product.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

post(*args, **kwargs)[source]

shuup.admin.modules.products.views.edit_package module

class shuup.admin.modules.products.views.edit_package.ProductChildrenFormPart(request, object=None)[source]

Bases: ProductChildrenBaseFormPart

invalid_modes = [ProductMode.VARIATION_CHILD, ProductMode.VARIABLE_VARIATION_PARENT, ProductMode.SIMPLE_VARIATION_PARENT]
priority: int = 1
get_form_defs()[source]
class shuup.admin.modules.products.views.edit_package.ProductPackageViewToolbar(view)[source]

Bases: ProductParentBaseToolbar

button_text = 'Clear package'
confirm_text = 'Are you sure? This will remove all products from the package.'
__init__(view)[source]
class shuup.admin.modules.products.views.edit_package.ProductPackageView(**kwargs)[source]

Bases: ProductParentBaseView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

template_name = 'shuup/admin/products/package/edit.jinja'
form_part_classes = [<class 'shuup.admin.modules.products.views.edit_package.ProductChildrenFormPart'>]
toolbar_class

alias of ProductPackageViewToolbar

dispatch(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]

Insert the form into the context dict.

dispatch_command(request, command)[source]

shuup.admin.modules.products.views.edit_parent module

class shuup.admin.modules.products.views.edit_parent.ProductChildrenBaseFormPart(request, object=None)[source]

Bases: FormPart

invalid_modes = []
priority: int = 0
form_name = None
get_form_defs(form, template_name)[source]
form_valid(form)[source]
class shuup.admin.modules.products.views.edit_parent.ProductParentBaseToolbar(view)[source]

Bases: Toolbar

__init__(view)[source]
class shuup.admin.modules.products.views.edit_parent.ProductParentBaseView(**kwargs)[source]

Bases: FormPartsViewMixin, 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
dispatch(request, *args, **kwargs)[source]
get_breadcrumb_parents()[source]
post(request, *args, **kwargs)[source]

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

get_form_part_classes()[source]
get_context_data(**kwargs)[source]

Insert the form into the context dict.

form_valid(form)[source]

If the form is valid, save the associated model.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

dispatch_command(request, command)[source]

shuup.admin.modules.products.views.list module

class shuup.admin.modules.products.views.list.ProductPicotable(request, columns, mass_actions, queryset, context)[source]

Bases: Picotable

process_item(object)[source]
class shuup.admin.modules.products.views.list.ProductListView[source]

Bases: PicotableListView

model

alias of ShopProduct

picotable_class

alias of ProductPicotable

product_listing_names = ['products']
default_columns = [<Column: Primary Image> primary_image, <Column: Name> product_name, <Column: SKU> product_sku, <Column: Barcode> product_barcode, <Column: Mode> product_mode, <Column: Primary Category> primary_category, <Column: Categories> categories]
related_objects = [('product', 'shuup.core.models:Product')]
mass_actions = ['shuup.admin.modules.products.mass_actions:VisibleMassAction', 'shuup.admin.modules.products.mass_actions:InvisibleMassAction', 'shuup.admin.modules.products.mass_actions:ExportProductsCSVAction', 'shuup.admin.modules.products.mass_actions:EditProductAttributesAction']
toolbar_buttons_provider_key: str | None = 'product_list_toolbar_provider'
mass_actions_provider_key: str | None = 'product_list_mass_actions_provider'
__init__()[source]
format_categories(instance)[source]
format_suppliers(instance)[source]
get_primary_image(instance)[source]
get_listing_product_kinds_values()[source]
get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

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]

shuup.admin.modules.products.views.mass_edit module

class shuup.admin.modules.products.views.mass_edit.MassEditForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: Form

base_fields = {'categories': <django.forms.models.ModelMultipleChoiceField object>, 'default_price_value': <django.forms.fields.DecimalField object>, 'name': <django.forms.fields.CharField object>, 'primary_category': <django.forms.models.ModelChoiceField object>, 'purchasable': <django.forms.fields.BooleanField object>, 'visibility': <enumfields.forms.EnumChoiceField object>}
declared_fields = {'categories': <django.forms.models.ModelMultipleChoiceField object>, 'default_price_value': <django.forms.fields.DecimalField object>, 'name': <django.forms.fields.CharField object>, 'primary_category': <django.forms.models.ModelChoiceField object>, 'purchasable': <django.forms.fields.BooleanField object>, 'visibility': <enumfields.forms.EnumChoiceField object>}
property media

Return all media required to render the widgets on this form.

class shuup.admin.modules.products.views.mass_edit.ProductMassEditView(**kwargs)[source]

Bases: MassEditMixin, FormView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

title = 'Mass Edit: Products'
form_class

alias of MassEditForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

shuup.admin.modules.products.views.toolbars module

class shuup.admin.modules.products.views.toolbars.ProductActionCategory(value)[source]

Bases: Enum

MAIN = 1
CHILD_CROSS_SELL = 2
CHILD_PACKAGE = 3
CHILD_OTHER = 5
class shuup.admin.modules.products.views.toolbars.EditProductToolbar(view)[source]

Bases: Toolbar

__init__(view)[source]

Module contents

class shuup.admin.modules.products.views.ProductCrossSellEditView(**kwargs)[source]

Bases: UpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

context_object_name = 'product'
form_class

alias of ProductCrossSellFormSet

form_valid(form)[source]

If the form is valid, save the associated model.

get_breadcrumb_parents()[source]
get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

model

alias of Product

template_name = 'shuup/admin/products/edit_cross_sell.jinja'
class shuup.admin.modules.products.views.ProductDeleteView(**kwargs)[source]

Bases: DetailView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

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

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of ShopProduct

post(request, *args, **kwargs)[source]
product_listing_names = ['products']
class shuup.admin.modules.products.views.ProductEditView(**kwargs)[source]

Bases: SaveFormPartsMixin, FormPartsViewMixin, CreateOrUpdateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

add_form_errors_as_messages = True
base_form_part_classes: Any | Any = []
context_object_name = 'product'
form_part_class_provide_key: str | None = 'admin_product_form_part'
form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_listing_product_kinds_values()[source]
get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

get_toolbar()[source]
model

alias of ShopProduct

product_listing_names = ['products']
template_name = 'shuup/admin/products/edit.jinja'
class shuup.admin.modules.products.views.ProductListView[source]

Bases: PicotableListView

__init__()[source]
default_columns = [<Column: Primary Image> primary_image, <Column: Name> product_name, <Column: SKU> product_sku, <Column: Barcode> product_barcode, <Column: Mode> product_mode, <Column: Primary Category> primary_category, <Column: Categories> categories]
format_categories(instance)[source]
format_suppliers(instance)[source]
get_listing_product_kinds_values()[source]
get_object_abstract(instance, item)[source]

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

Supported keys in abstract line dicts are:

  • text (required)

  • title

  • class (CSS class name – header for instance)

  • raw (boolean; whether or not the text is raw HTML)

Parameters:
  • instance – The instance.

  • item – The item dict so far. Useful for reusing precalculated values.

Returns:

Iterable of dicts to pass through to the picotable javascript.

Return type:

Iterable[dict]

get_primary_image(instance)[source]
get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

mass_actions = ['shuup.admin.modules.products.mass_actions:VisibleMassAction', 'shuup.admin.modules.products.mass_actions:InvisibleMassAction', 'shuup.admin.modules.products.mass_actions:ExportProductsCSVAction', 'shuup.admin.modules.products.mass_actions:EditProductAttributesAction']
mass_actions_provider_key: str | None = 'product_list_mass_actions_provider'
model

alias of ShopProduct

picotable_class

alias of ProductPicotable

product_listing_names = ['products']
related_objects = [('product', 'shuup.core.models:Product')]
toolbar_buttons_provider_key: str | None = 'product_list_toolbar_provider'
class shuup.admin.modules.products.views.ProductPackageView(**kwargs)[source]

Bases: ProductParentBaseView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

dispatch(request, *args, **kwargs)[source]
dispatch_command(request, command)[source]
form_part_classes = [<class 'shuup.admin.modules.products.views.edit_package.ProductChildrenFormPart'>]
get_context_data(**kwargs)[source]

Insert the form into the context dict.

template_name = 'shuup/admin/products/package/edit.jinja'
toolbar_class

alias of ProductPackageViewToolbar

class shuup.admin.modules.products.views.ProductMediaEditView(**kwargs)[source]

Bases: 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 ProductMediaForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_breadcrumb_parents()[source]
get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

model

alias of Product

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

Bases: MassEditMixin, FormView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

form_class

alias of MassEditForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

title = 'Mass Edit: Products'
class shuup.admin.modules.products.views.ProductMediaBulkAdderView(**kwargs)[source]

Bases: View

Adds media in bulk to a pre-existing product.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

post(*args, **kwargs)[source]