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

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

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

Bases: BulkActionView

View for executing contact bulk actions

get_extra_filters() Q[source]

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

Return type:

Q

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

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

Bases: ContactBulkAction

Bulk action to delete multiple contacts at once

get_permission_required() tuple[str][source]

This method overwrites get_permission_required()

Returns:

The needed permission to delete contacts

Return type:

tuple[str]

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

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

Bases: ContactBulkAction

Bulk action to restore multiple contacts at once

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

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

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

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

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

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

The template to render (see TemplateResponseMixin)

Contact List View

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

Bases: TemplateView, ContactContextMixin

View for listing contacts

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