web.views.account_views package

web.views.account_views package containing views for the core.models.Account data.

class web.views.account_views.AccountCreateView(**kwargs)[source]

Bases: LoginRequiredMixin, CreateView

View for creating a single core.models.Account instance.

URL_NAME = 'account-create'
model

alias of Account

form_class

alias of BaseAccountForm

template_name = 'web/account/account_create.html'
get_form(form_class=None)[source]

Return an instance of the form to be used in this view.

Return type:

BaseAccountForm

Parameters:

form_class (type[BaseAccountForm] | None)

class web.views.account_views.AccountDetailWithDeleteView(**kwargs)[source]

Bases: LoginRequiredMixin, DetailWithDeleteView, CustomActionMixin, TestActionMixin

View for a single core.models.Account instance.

URL_NAME = 'account-detail'
model

alias of Account

template_name = 'web/account/account_detail.html'
success_url = '/accounts/'
get_queryset()[source]

Restricts the queryset to objects owned by the requesting user.

Return type:

QuerySet

get_context_data(**kwargs)[source]

Extended to add the accounts latest emails to the context.

Return type:

dict[str, Any]

Parameters:

kwargs (Any)

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

Creates response to a post request.

If no action matches the existing handlers, responds with Http204. Should be executed last in a custom view post method.

Parameters:
Return type:

HttpResponse

Returns:

The handlers response to the request. If no matching handler is found Http204.

Raises:

ImproperlyConfigured – If the called handler method does not return a django.http.HttpResponse.>

handle_update_mailboxes(request)[source]

Handler function for the update-mailboxes action.

Parameters:

request (HttpRequest) – The action request to handle.

Return type:

HttpResponse

Returns:

A template response with the updated view after the action.

handle_add_daemons(request)[source]

Handler function for the add-daemons action.

Parameters:

request (HttpRequest) – The action request to handle.

Return type:

HttpResponse

Returns:

A template response with the updated view after the action.

class web.views.account_views.AccountEmailsFilterView(**kwargs)[source]

Bases: EmailFilterView, SingleObjectMixin

View for filtering listed core.models.Email instances belonging to a certain account.

URL_NAME = 'account-emails'
template_name = 'web/account/account_email_filter_list.html'
get_queryset()[source]

Restricts the queryset to objects owned by the requesting user.

Return type:

QuerySet

get_context_data(**kwargs)[source]

Extended method to pass the query parameters to the context.

References

https://jeffpohlmeyer.com/django-filters-with-pagination

Return type:

dict[str, Any]

Returns:

The view’s context with added query parameters.

Parameters:

kwargs (Any)

class web.views.account_views.AccountEmailsTableView(**kwargs)[source]

Bases: SingleTableMixin, AccountEmailsFilterView

View for tabling core.models.Email instances belonging to a certain account.

URL_NAME = 'account-emails-table'
template_name = 'web/account/account_email_table.html'
table_class

alias of BaseEmailTable

get_paginate_by(table_data)[source]

Overridden to reconcile mixin and view.

Return type:

int

Parameters:

table_data (QuerySet)

class web.views.account_views.AccountFilterView(**kwargs)[source]

Bases: LoginRequiredMixin, FilterPageView

View for filtering listed core.models.Account instances.

URL_NAME = 'account-filter-list'
model

alias of Account

template_name = 'web/account/account_filter_list.html'
filterset_class

alias of AccountFilterSet

ordering = ['-is_favorite', 'mail_address']
get_queryset()[source]

Restricts the queryset to objects owned by the requesting user.

Return type:

QuerySet

class web.views.account_views.AccountTableView(**kwargs)[source]

Bases: SingleTableMixin, AccountFilterView

View for filtering a table of core.models.Account instances.

URL_NAME = 'account-table'
template_name = 'web/account/account_table.html'
table_class

alias of BaseAccountTable

get_paginate_by(table_data)[source]

Overridden to reconcile mixin and view.

Return type:

int

Parameters:

table_data (QuerySet)

class web.views.account_views.AccountUpdateOrDeleteView(**kwargs)[source]

Bases: LoginRequiredMixin, UpdateOrDeleteView

View for updating or deleting a single core.models.Account instance.

URL_NAME = 'account-edit'
model

alias of Account

form_class

alias of BaseAccountForm

template_name = 'web/account/account_edit.html'
delete_success_url = '/accounts/'

The URL to redirect to after deletion. Must be set.

get_queryset()[source]

Restricts the queryset to objects owned by the requesting user.

Return type:

QuerySet

get_form(form_class=None)[source]

Return an instance of the form to be used in this view.

Return type:

BaseAccountForm

Parameters:

form_class (type[BaseAccountForm] | None)

Submodules