shuup.notify.script_template package
Submodules
shuup.notify.script_template.factory module
- shuup.notify.script_template.factory.generic_send_email_script_template_factory(identifier, event, name, description, help_text, initial=None)[source]
A factory to create a generic script template based on
GenericSendEmailScriptTemplate
class.- Parameters:
identifier (str) – a unique identifier for this ScriptTemplate with a max of 64 characters
event (shuup.notify.Event) – the event class which will be used to trigger the notification
name (str) – the name of the ScriptTemplate
description (str) – the description of the ScriptTemplate to present to the user
help_text (str) – a text to help users understand how this script will work
initial (dict|None) – the initial data to use in forms or None
shuup.notify.script_template.generic module
- class shuup.notify.script_template.generic.GenericScriptTemplateEmailContentForm(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
Generic form which contains the content of a email: subject and body.
- base_fields = {'body': <django.forms.fields.CharField object>, 'subject': <django.forms.fields.CharField object>}
- declared_fields = {'body': <django.forms.fields.CharField object>, 'subject': <django.forms.fields.CharField object>}
- property media
Return all media required to render the widgets on this form.
- class shuup.notify.script_template.generic.GenericScriptTemplateEmailForm(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
Generic form which contains a destination of the email.
- SEND_TO_CHOICES = [('customer', 'Customer'), ('other', 'Other destination')]
- 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__’.
- base_fields = {'recipient': <django.forms.fields.EmailField object>, 'send_to': <django.forms.fields.ChoiceField object>}
- declared_fields = {'recipient': <django.forms.fields.EmailField object>, 'send_to': <django.forms.fields.ChoiceField object>}
- property media
Return all media required to render the widgets on this form.
- class shuup.notify.script_template.generic.GenericSendEmailScriptTemplate(script_instance=None)[source]
Bases:
BaseScriptTemplate
A generic ScriptTemplate which needs email configurations such as recipient, subject and body.
This class also deals with a multi-language form to receive translated email’s subject and body.
The form of this ScriptTemplate is a
FormGroup
which will contain abase
form which has no translation and also intances ofmultilingual_form_class
, one for each available LANGUAGE. Only the form for the default language (provided byPARLER_DEFAULT_LANGUAGE_CODE
setting) is required.- Ivar:
django.form.Form base_form_class: the main form, not included in the group of translation fields.
- Ivar:
django.form.Form multilingual_form_class: the form which will be created for each available language.
- Parameters:
script_instance (shuup.notify.models.script.Script|None) – script instance to change or None
- template_name = 'notify/admin/generic_script_template.jinja'
- extra_js_template_name = 'notify/admin/generic_script_template_extra_js.jinja'
- base_form_class
alias of
GenericScriptTemplateEmailForm
- multilingual_form_class
- get_script_steps(form)[source]
Returns a list of Steps to use in the script.
- Parameters:
form (django.forms.Form|None) – validated form to use or None
- Returns:
list of steps
- Return type:
list[shuup.notify.Step]
- get_initial()[source]
Returns the initial data to use for configuration form.
Note: You must also check for the bound
script_instance
attribute. One can edit the Script created by the template editor through the form this instance provides. This way, when a script instance is bound, you must return the the representantion of the Script as the initial form data.- Returns:
initial data to to use in configuration form
- Return type:
Module contents
- class shuup.notify.script_template.BaseScriptTemplate(script_instance=None)[source]
Bases:
ScriptTemplate
A base ScriptTemplate class which provides implementation for create and update the script.
- Parameters:
script_instance (shuup.notify.models.script.Script|None) – script instance to change or None
- get_script_steps(form=None)[source]
Returns a list of Steps to use in the script.
- Parameters:
form (django.forms.Form|None) – validated form to use or None
- Returns:
list of steps
- Return type:
list[shuup.notify.Step]