shuup.admin.forms package

Submodules

shuup.admin.forms.fields module

class shuup.admin.forms.fields.PercentageField(*, max_value=None, min_value=None, max_digits=None, decimal_places=None, **kwargs)[source]

Bases: DecimalField

MULTIPLIER = Decimal('100')
prepare_value(value)[source]
to_python(value)[source]

Validate that the input is a decimal number. Return a Decimal instance or None for empty values. Ensure that there are no more than max_digits in the number and no more than decimal_places digits after the decimal point.

widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

class shuup.admin.forms.fields.Select2ModelField(model, *args, **kwargs)[source]

Bases: Field

This form field class is deprecated and it will be removed on version 3. Use ObjectSelect2ModelField class instead.

widget

alias of Select

__init__(model, *args, **kwargs)[source]
prepare_value(value)[source]
to_python(value)[source]
widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

class shuup.admin.forms.fields.Select2MultipleField(model, search_mode=None, *args, **kwargs)[source]

Bases: Field

This form field class is deprecated and it will be removed on version 3. Use ObjectSelect2MultipleField class instead.

widget

alias of SelectMultiple

__init__(model, search_mode=None, *args, **kwargs)[source]
prepare_value(value)[source]
to_python(value)[source]
widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

class shuup.admin.forms.fields.Select2ModelMultipleField(model, search_mode=None, *args, **kwargs)[source]

Bases: Select2MultipleField

Just like Select2MultipleField, but return instances instead of ids.

This form field class is deprecated and it will be removed on version 3. Use ObjectSelect2ModelMultipleField class instead.

prepare_value(value)[source]
to_python(value)[source]
class shuup.admin.forms.fields.Select2MultipleMainProductField(model, search_mode=None, *args, **kwargs)[source]

Bases: Select2MultipleField

Search only from parent and normal products.

This form field class is deprecated and it will be removed on version 3. Use ObjectSelect2MultipleMainProductField class instead.

widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

class shuup.admin.forms.fields.WeekdaysSelectMultiple(attrs=None, choices=())[source]

Bases: SelectMultiple

format_value(value)[source]

Return selected values as a list.

property media
class shuup.admin.forms.fields.WeekdayField(choices=(), required=True, widget=None, label=None, initial=None, help_text='', *args, **kwargs)[source]

Bases: MultipleChoiceField

widget

alias of WeekdaysSelectMultiple

DAYS_OF_THE_WEEK = [(0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday')]
__init__(choices=(), required=True, widget=None, label=None, initial=None, help_text='', *args, **kwargs)[source]
clean(value)[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

class shuup.admin.forms.fields.ObjectSelect2ModelField(model, selector=None, search_mode=None, *args, **kwargs)[source]

Bases: Select2ModelField

Class for select2 form fields. Replacement for the class Select2ModelField.

__init__(model, selector=None, search_mode=None, *args, **kwargs)[source]
prepare_value(value)[source]
to_python(value)[source]
widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

class shuup.admin.forms.fields.ObjectSelect2MultipleField(model, selector=None, search_mode=None, *args, **kwargs)[source]

Bases: Select2MultipleField

Class for select2 form fields. Replacement for the class Select2MultipleField.

__init__(model, selector=None, search_mode=None, *args, **kwargs)[source]
prepare_value(value)[source]
to_python(value)[source]
widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

class shuup.admin.forms.fields.ObjectSelect2ModelMultipleField(model, selector=None, search_mode=None, *args, **kwargs)[source]

Bases: Select2ModelMultipleField

Class for select2 form fields. Replacement for the class Select2ModelMultipleField.

__init__(model, selector=None, search_mode=None, *args, **kwargs)[source]
prepare_value(value)[source]
to_python(value)[source]
widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

class shuup.admin.forms.fields.ObjectSelect2MultipleMainProductField(model, selector=None, search_mode=None, *args, **kwargs)[source]

Bases: Select2MultipleMainProductField

Class for select2 form fields. Replacement for the class Select2MultipleMainProductField.

__init__(model, selector=None, search_mode=None, *args, **kwargs)[source]
prepare_value(value)[source]
to_python(value)[source]
widget_attrs(widget)[source]

Given a Widget instance (not a Widget class), return a dictionary of any HTML attributes that should be added to the Widget, based on this Field.

shuup.admin.forms.quick_select module

class shuup.admin.forms.quick_select.NoModel[source]

Bases: object

class shuup.admin.forms.quick_select.QuickAddRelatedObjectMultiSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultipleSelectMixin, SelectMultiple

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

get_context(name, value, attrs)[source]
property media
template_name = 'shuup/admin/forms/widgets/quick_add_select.jinja'
class shuup.admin.forms.quick_select.QuickAddRelatedObjectSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelectMixin, Select

Parameters:

int (initial) – primary key of the object that is initially selected

get_context(name, value, attrs)[source]
property media
template_name = 'shuup/admin/forms/widgets/quick_add_select.jinja'

shuup.admin.forms.widgets module

class shuup.admin.forms.widgets.BasePopupChoiceWidget(attrs=None, clearable=False, empty_text=True)[source]

Bases: Widget

browse_kind = None
filter = None
browse_text = 'Select'
select_icon = 'fa fa-folder'
clear_icon = 'fa fa-trash'
external_icon = 'fa fa-external-link'
__init__(attrs=None, clearable=False, empty_text=True)[source]
get_browse_markup()[source]
get_clear_markup()[source]
render_text(obj)[source]
get_object(value)[source]
render(name, value, attrs=None, renderer=None)[source]

Render the widget as an HTML string.

property media
class shuup.admin.forms.widgets.FileDnDUploaderWidget(attrs=None, kind=None, upload_path='/', clearable=False, browsable=True, upload_url=None, dropzone_attrs=None)[source]

Bases: Widget

__init__(attrs=None, kind=None, upload_path='/', clearable=False, browsable=True, upload_url=None, dropzone_attrs=None)[source]
render(name, value, attrs=None, renderer=None)[source]

Render the widget as an HTML string.

property media
class shuup.admin.forms.widgets.TextEditorWidget(attrs=None)[source]

Bases: Textarea

render(name, value, attrs=None, renderer=None)[source]

Render the widget as an HTML string.

property media
class shuup.admin.forms.widgets.MediaChoiceWidget(attrs=None, clearable=False, empty_text=True)[source]

Bases: BasePopupChoiceWidget

browse_kind = 'media'
browse_text = 'Select Media'
get_object(value)[source]
property media
class shuup.admin.forms.widgets.ImageChoiceWidget(attrs=None, clearable=False, empty_text=True)[source]

Bases: MediaChoiceWidget

filter = 'images'
browse_text = 'Select Image'
property media
class shuup.admin.forms.widgets.ProductChoiceWidget(attrs=None, clearable=False, empty_text=True)[source]

Bases: BasePopupChoiceWidget

browse_kind = 'product'
browse_text = 'Select Product'
get_object(value)[source]
property media
class shuup.admin.forms.widgets.ContactChoiceWidget(attrs=None, clearable=False, empty_text=True)[source]

Bases: BasePopupChoiceWidget

browse_kind = 'contact'
browse_text = 'Select Contact'
icon = 'fa fa-user'
get_object(value)[source]
get_browse_markup()[source]
property media
class shuup.admin.forms.widgets.HexColorWidget(attrs=None)[source]

Bases: TextInput

render(name, value, attrs=None, renderer=None)[source]

Render the widget as an HTML string.

property media
class shuup.admin.forms.widgets.CodeEditorWithHTMLPreview(attrs=None)[source]

Bases: Textarea

template_name = 'shuup/admin/forms/widgets/code_editor_with_preview.html'
render(name, value, attrs=None, renderer=None)[source]

Render the widget as an HTML string.

property media
class shuup.admin.forms.widgets.PersonContactChoiceWidget(attrs=None, clearable=False, empty_text=True)[source]

Bases: ContactChoiceWidget

property filter
property media
class shuup.admin.forms.widgets.PackageProductChoiceWidget(attrs=None, clearable=False, empty_text=True)[source]

Bases: ProductChoiceWidget

filter = '{"modes": [0, 4]}'
property media
class shuup.admin.forms.widgets.QuickAddSupplierMultiSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultiSelect

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

url = '/sa/suppliers/new/'
model = 'shuup.Supplier'
property media
class shuup.admin.forms.widgets.QuickAddCategoryMultiSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultiSelect

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

url = '/sa/categories/new/'
model = 'shuup.Category'
property media
class shuup.admin.forms.widgets.QuickAddCategorySelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/categories/new/'
model = 'shuup.Category'
property media
class shuup.admin.forms.widgets.QuickAddProductTypeSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/product-types/new/'
model = 'shuup.ProductType'
property media
class shuup.admin.forms.widgets.QuickAddTaxGroupSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/taxes/customer-tax-group/new/'
model = 'shuup.CustomerTaxGroup'
property media
class shuup.admin.forms.widgets.QuickAddTaxClassSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/taxes/tax-class/new/'
property media
class shuup.admin.forms.widgets.QuickAddSalesUnitSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/sales-units/new/'
property media
class shuup.admin.forms.widgets.QuickAddDisplayUnitSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/display-units/new/'
property media
class shuup.admin.forms.widgets.QuickAddManufacturerSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/manufacturers/new/'
model = 'shuup.Manufacturer'
property media
class shuup.admin.forms.widgets.QuickAddPaymentMethodsSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultiSelect

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

url = '/sa/payment_method/new/'
property media
class shuup.admin.forms.widgets.QuickAddShippingMethodsSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultiSelect

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

url = '/sa/shipping_method/new/'
property media
class shuup.admin.forms.widgets.QuickAddUserMultiSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultiSelect

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

url = '/sa/users/new/'
property media
class shuup.admin.forms.widgets.QuickAddContactGroupSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelect

Parameters:

int (initial) – primary key of the object that is initially selected

url = '/sa/contact_group/new/'
property media
class shuup.admin.forms.widgets.QuickAddContactGroupMultiSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultiSelect

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

url = '/sa/contact_group/new/'
property media
class shuup.admin.forms.widgets.QuickAddLabelMultiSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultiSelect

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

url = '/sa/labels/new/'
property media
class shuup.admin.forms.widgets.TimeInput(attrs=None, format=None)[source]

Bases: TimeInput

input_type = 'time'
property media

Module contents

class shuup.admin.forms.EmailAuthenticationForm(*args, **kwargs)[source]

Bases: AuthenticationForm

The ‘request’ parameter is set for custom auth use by subclasses. The form data comes in via the standard ‘data’ kwarg.

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

The ‘request’ parameter is set for custom auth use by subclasses. The form data comes in via the standard ‘data’ kwarg.

base_fields = {'password': <django.forms.fields.CharField object>, 'username': <django.contrib.auth.forms.UsernameField object>}
clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

clean_username()[source]
declared_fields = {'password': <django.forms.fields.CharField object>, 'username': <django.contrib.auth.forms.UsernameField object>}
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 the same email, only username can be used to log in.'}
property media

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

class shuup.admin.forms.ShuupAdminForm(**kwargs)[source]

Bases: MultiLanguageModelForm

__init__(**kwargs)[source]
base_fields = {}
declared_fields = {}
property media

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

class shuup.admin.forms.ShuupAdminFormNoTranslation(**kwargs)[source]

Bases: ModelForm

__init__(**kwargs)[source]
base_fields = {}
declared_fields = {}
property media

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

class shuup.admin.forms.QuickAddRelatedObjectMultiSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectMultipleSelectMixin, SelectMultiple

Parameters:

list[int] (initial) – list of primary keys of the objects that are initially selected

get_context(name, value, attrs)[source]
property media
template_name = 'shuup/admin/forms/widgets/quick_add_select.jinja'
class shuup.admin.forms.QuickAddRelatedObjectSelect(attrs=None, choices=(), editable_model=None, initial=None, model=None)[source]

Bases: QuickAddRelatedObjectSelectMixin, Select

Parameters:

int (initial) – primary key of the object that is initially selected

get_context(name, value, attrs)[source]
property media
template_name = 'shuup/admin/forms/widgets/quick_add_select.jinja'