web.views.correspondent_views package

web.views.correspondent_views package containing views for the core.models.Correspondent data.

class web.views.correspondent_views.CorrespondentDetailWithDeleteView(**kwargs)[source]

Bases: LoginRequiredMixin, DetailWithDeleteView, CustomActionMixin

View for a single core.models.Correspondent instance.

URL_NAME = 'correspondent-detail'
model

alias of Correspondent

template_name = 'web/correspondent/correspondent_detail.html'
success_url = '/correspondents/'
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_share(request)[source]

Handler function for the share 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.correspondent_views.CorrespondentEmailsFilterView(**kwargs)[source]

Bases: LoginRequiredMixin, FilterPageView, SingleObjectMixin

View for filtering listed core.models.EmailCorrespondent instances with a certain correspondent.

URL_NAME = 'correspondent-emails'
model

alias of EmailCorrespondent

template_name = 'web/correspondent/correspondent_email_filter_list.html'
context_object_name = 'correspondent_emails'
filterset_class

alias of CorrespondentEmailFilterSet

ordering = ['-created']
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.

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.correspondent_views.CorrespondentEmailsTableView(**kwargs)[source]

Bases: SingleTableMixin, CorrespondentEmailsFilterView

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

URL_NAME = 'correspondent-emails-table'
template_name = 'web/correspondent/correspondent_email_table.html'
table_class

alias of BaseCorrespondentEmailTable

get_paginate_by(table_data)[source]

Overridden to reconcile mixin and view.

Return type:

int

Parameters:

table_data (QuerySet)

class web.views.correspondent_views.CorrespondentFilterView(**kwargs)[source]

Bases: LoginRequiredMixin, FilterPageView

View for filtering listed core.models.Correspondent instances.

URL_NAME = 'correspondent-filter-list'
model

alias of Correspondent

template_name = 'web/correspondent/correspondent_filter_list.html'
context_object_name = 'correspondents'
filterset_class

alias of CorrespondentFilterSet

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

Restricts the queryset to objects owned by the requesting user.

Return type:

QuerySet

class web.views.correspondent_views.CorrespondentTableView(**kwargs)[source]

Bases: SingleTableMixin, CorrespondentFilterView

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

URL_NAME = 'correspondent-table'
template_name = 'web/correspondent/correspondent_table.html'
table_class

alias of BaseCorrespondentTable

get_paginate_by(table_data)[source]

Overridden to reconcile mixin and view.

Return type:

int

Parameters:

table_data (QuerySet)

class web.views.correspondent_views.CorrespondentUpdateOrDeleteView(**kwargs)[source]

Bases: LoginRequiredMixin, UpdateOrDeleteView

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

URL_NAME = 'correspondent-edit'
model

alias of Correspondent

form_class

alias of BaseCorrespondentForm

template_name = 'web/correspondent/correspondent_edit.html'
delete_success_url = '/correspondents/'

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

Submodules