Contacts

Contact Actions

integreat_cms.cms.views.contacts.contact_actions.archive_contact(request: HttpRequest, contact_id: int, region_slug: str) HttpResponseRedirect[source]

Method that archives a given contact

Parameters:
  • request (HttpRequest) – The current request

  • contact_id (int) – Id of the existing contact that is supposed to be archived

  • region_slug (str) – The slug of the current region

Returns:

A redirection to the ContactListView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.contacts.contact_actions.copy_contact(request: HttpRequest, contact_id: int, region_slug: str) HttpResponseRedirect[source]

Method that copies an existing contact

Parameters:
  • request (HttpRequest) – The current request

  • contact_id (int) – Id of the existing contact that is supposed to be copied

  • region_slug (str) – The slug of the current region

Returns:

A redirection to the ContactListView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.contacts.contact_actions.delete_contact(request: HttpRequest, contact_id: int, region_slug: str) HttpResponseRedirect[source]

Delete given contact

Parameters:
  • request (HttpRequest) – The current request

  • contact_id (int) – The id of the contact which should be deleted

  • region_slug (str) – The slug of the current region

Returns:

A redirection to the ContactListView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.contacts.contact_actions.restore_contact(request: HttpRequest, contact_id: int, region_slug: str) HttpResponseRedirect[source]

Restore given contact

Parameters:
  • request (HttpRequest) – The current request

  • contact_id (int) – The id of the contact which should be restored

  • region_slug (str) – The slug of the current region

Returns:

A redirection to the ContactListView

Return type:

HttpResponseRedirect

Contact Bulk Actions

class integreat_cms.cms.views.contacts.contact_bulk_actions.ArchiveContactBulkAction(**kwargs)[source]

Bases: ContactBulkAction

Bulk action to archive multiple contacts at once

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request, *args, **kwargs)[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Overwrite to filter queryset for region of the location since contact gets its region from location

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required() tuple[str][source]

Override this method to override the permission_required attribute.

Returns:

The permissions that are required for views inheriting from this Mixin

Return type:

tuple[str]

get_queryset() Any[source]

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

handle_no_permission()[source]
has_permission()[source]

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

http_method_not_allowed(request, *args, **kwargs)[source]
login_url = None[source]
model[source]

alias of Contact

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Archive multiple contacts at once

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The redirect

Return type:

HttpResponse

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
view_is_async = False[source]
class integreat_cms.cms.views.contacts.contact_bulk_actions.ContactBulkAction(**kwargs)[source]

Bases: BulkActionView

View for executing contact bulk actions

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request, *args, **kwargs)[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Overwrite to filter queryset for region of the location since contact gets its region from location

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required() tuple[str][source]

Override this method to override the permission_required attribute.

Returns:

The permissions that are required for views inheriting from this Mixin

Return type:

tuple[str]

get_queryset() Any[source]

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

handle_no_permission()[source]
has_permission()[source]

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

http_method_not_allowed(request, *args, **kwargs)[source]
login_url = None[source]
model[source]

The model of this BulkActionView

Parameters:
  • id (BigAutoField) – Primary key: ID

  • point_of_contact_for (TruncatingCharField) – Point of contact for

  • name (CharField) – Name

  • email (EmailField) – Email address

  • phone_number (CharField) – Phone number

  • website (URLField) – Website

  • archived (BooleanField) – Archived. Whether or not the location is read-only and hidden in the API.

  • last_updated (DateTimeField) – Modification date

  • created_date (DateTimeField) – Creation date

Relationship fields:

Parameters:

location (ForeignKey to POI) – Location (related name: contacts)

alias of Contact

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request, *args, **kwargs)[source]
prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
view_is_async = False[source]
class integreat_cms.cms.views.contacts.contact_bulk_actions.DeleteContactBulkAction(**kwargs)[source]

Bases: ContactBulkAction

Bulk action to delete multiple contacts at once

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request, *args, **kwargs)[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Overwrite to filter queryset for region of the location since contact gets its region from location

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required() tuple[str][source]

This method overwrites get_permission_required()

Returns:

The needed permission to delete contacts

Return type:

tuple[str]

get_queryset() Any[source]

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

handle_no_permission()[source]
has_permission()[source]

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

http_method_not_allowed(request, *args, **kwargs)[source]
login_url = None[source]
model[source]

alias of Contact

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Function to delete multiple contacts at once

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The redirect

Return type:

HttpResponse

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
view_is_async = False[source]
class integreat_cms.cms.views.contacts.contact_bulk_actions.RestoreContactBulkAction(**kwargs)[source]

Bases: ContactBulkAction

Bulk action to restore multiple contacts at once

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request, *args, **kwargs)[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Overwrite to filter queryset for region of the location since contact gets its region from location

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required() tuple[str][source]

Override this method to override the permission_required attribute.

Returns:

The permissions that are required for views inheriting from this Mixin

Return type:

tuple[str]

get_queryset() Any[source]

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

handle_no_permission()[source]
has_permission()[source]

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

http_method_not_allowed(request, *args, **kwargs)[source]
login_url = None[source]
model[source]

alias of Contact

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Function to restore multiple contacts at once

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The redirect

Return type:

HttpResponse

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
view_is_async = False[source]

Contact Context Mixin

class integreat_cms.cms.views.contacts.contact_context_mixin.ContactContextMixin[source]

Bases: ContextMixin

This mixin provides extra context for language tree views

__init__()[source]
extra_context = None[source]
get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

Contact Form View

class integreat_cms.cms.views.contacts.contact_form_view.ContactFormView(**kwargs)[source]

Bases: TemplateView, ContactContextMixin

Class for rendering the contact form

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

content_type = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Render contact form for HTTP GET requests

Parameters:
  • request (HttpRequest) – Object representing the user call

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The rendered template response

Return type:

HttpResponse

get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

post(request: HttpRequest, **kwargs: Any) HttpResponse[source]

Save contact and ender contact form for HTTP POST requests

Parameters:
  • request (HttpRequest) – Object representing the user call

  • **kwargs (Any) – The supplied keyword arguments

Raises:

PermissionDenied – If user does not have the permission to change contact

Returns:

The rendered template response

Return type:

HttpResponse

render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class[source]

alias of TemplateResponse

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

Initialize attributes shared by all view methods.

template_engine = None[source]
template_name = 'contacts/contact_form.html'[source]

The template to render (see TemplateResponseMixin)

view_is_async = False[source]

Contact List View

class integreat_cms.cms.views.contacts.contact_list_view.ContactListView(**kwargs)[source]

Bases: TemplateView, ContactContextMixin

View for listing contacts

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

archived = False[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

content_type = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Render contact list

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The rendered template response

Return type:

HttpResponse

get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class[source]

alias of TemplateResponse

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

Initialize attributes shared by all view methods.

template_engine = None[source]
template_name = 'contacts/contact_list.html'[source]
view_is_async = False[source]