mails.views module

class mails.views.MailViewBase(*args, **kwargs)[source]

Bases: object

Send a templated email after being edited by user.

form_class = None
mail_code = None
mail_config = {}
mail_variables = {}
fail_silently = True
can_send_mail()[source]

Overwrite method to control permissions for sending mails.

get_mail_config()[source]
class mails.views.MailFormView(*args, **kwargs)[source]

Bases: mails.views.MailViewBase, django.views.generic.edit.UpdateView

MailUpdateView acts as a base class-based form view, but will intercept the POST request of the original form. It’ll render the email edit form and save/send both after validation.

get_template_names()[source]

The mail editor form has its own template.

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

Save forms or intercept the request.

form_valid(form)[source]

If both the regular form and mailing form are valid, save both.

get_success_url()[source]

Returns the supplied URL.

class mails.views.MailView(*args, **kwargs)[source]

Bases: mails.views.MailViewBase, django.views.generic.edit.UpdateView

form_class

alias of mails.forms.EmailForm

template_name = 'mails/mail_form.html'
get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

form_valid(form)[source]

If both the regular form and mailing form are valid, save both.

class mails.views.MailEditorSubview(request, mail_code, context=None, header_template=None, **kwargs)[source]

Bases: object

This subview works as an interrupter for function based views.

If a FBV is completed, the MailEditingSubview will interrupt the request and provide a form that give the user the possibility to edit a template based email before sending it.

template_name = 'mails/mail_form.html'
interrupt()[source]

Interrupt request by rendering the templated email form.

The request should be an HttpRequest instance that should be captured and be included into the response of the interrupted response. Currently only POST requests are supported.

is_valid()[source]

See if data is returned and valid.

send_mail()[source]

Send email as returned by user.

class mails.views.MailEditorSubviewHTMX(request, mail_code, context=None, header_template=None, **kwargs)[source]

Bases: mails.views.MailEditorSubview

template_name = 'mails/_hx_mail_form.html'
class mails.views.MailEditorMixin[source]

Bases: object

Deprecated.