POIs

This package contains all views related to POIs (points of interest)

POI Actions

This module contains view actions for objects related to POIs.

integreat_cms.cms.views.pois.poi_actions.archive_poi(request: HttpRequest, poi_id: int, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Archive POI object

Parameters:
  • request (HttpRequest) – The current request

  • poi_id (int) – The id of the POI which should be archived

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

  • language_slug (str) – The slug of the current language

Returns:

A redirection to the POIListView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pois.poi_actions.auto_complete_address(request: HttpRequest, region_slug: str) JsonResponse[source]

Autocomplete location address and coordinates

Parameters:
  • request (HttpRequest) – The current request

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

Raises:

Http404 – If no location was found for the given address

Returns:

The address and coordinates of the location

Return type:

JsonResponse

integreat_cms.cms.views.pois.poi_actions.delete_poi(request: HttpRequest, poi_id: int, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Delete POI object

Parameters:
  • request (HttpRequest) – The current request

  • poi_id (int) – The id of the POI which should be deleted

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

  • language_slug (str) – The slug of the current language

Returns:

A redirection to the POIListView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pois.poi_actions.get_address_from_coordinates(request: HttpRequest, region_slug: str) JsonResponse[source]

Derive address from the coordinates (map pin position)

Parameters:
  • request (HttpRequest) – The current request

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

Raises:

Http404 – If no address was found for the given coordinates

Returns:

The address of the location

Return type:

JsonResponse

integreat_cms.cms.views.pois.poi_actions.restore_poi(request: HttpRequest, poi_id: int, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Restore POI object (set archived=False)

Parameters:
  • request (HttpRequest) – The current request

  • poi_id (int) – The id of the POI which should be restored

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

  • language_slug (str) – The slug of the current language

Returns:

A redirection to the POIListView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pois.poi_actions.view_poi(request: HttpRequest, poi_id: int, region_slug: str, language_slug: str) HttpResponse[source]

View POI object

Parameters:
  • request (HttpRequest) – The current request

  • poi_id (int) – The id of the POI which should be viewed

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

  • language_slug (str) – The slug of the current language

Raises:

Http404 – If user no translation exists for the requested POI and language

Returns:

A redirection to the POIListView

Return type:

HttpResponse

POI Context Mixin

class integreat_cms.cms.views.pois.poi_context_mixin.POIContextMixin[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]

POI Form Ajax View

class integreat_cms.cms.views.pois.poi_form_ajax_view.POIFormAjaxView(**kwargs)[source]

Bases: TemplateView, POIContextMixin

View for the ajax POI widget

__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 a POI form widget template

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The html template of a POI form

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, *args: Any, **kwargs: Any) HttpResponse[source]

Add a new POI to the database

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Raises:

Http404 – If no language for the given language slug was found

Returns:

A status message, either a success or an error message

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 = 'ajax_poi_form/_poi_form_widget.html'[source]

Template for ajax POI widget

template_engine = None[source]
template_name = None[source]
view_is_async = False[source]

POI Form View

A view representing an instance of a point of interest. POIs can be created or updated via this view.

class integreat_cms.cms.views.pois.poi_form_view.POIFormView(**kwargs)[source]

Bases: TemplateView, POIContextMixin, MediaContextMixin, ContentEditLockMixin

View for editing POIs

__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.

back_url_name: str | None = 'pois'[source]

The url name of the view to show if the user decides to go back (see ContentEditLockMixin)

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

Render POIForm and POITranslationForm

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.

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

Submit POIForm and POITranslationForm and save POI and POITranslation objects

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

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 = 'pois/poi_form.html'[source]

The template to render (see TemplateResponseMixin)

view_is_async = False[source]

POI List View

class integreat_cms.cms.views.pois.poi_list_view.POIListView(**kwargs)[source]

Bases: TemplateView, POIContextMixin, MachineTranslationContextMixin

View for listing POIs (points of interests)

__init__(**kwargs)[source]

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

archived = False[source]

Whether or not to show archived POIs

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 POI 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.

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

Apply the query and filter the rendered pois

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

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 = 'pois/poi_list.html'[source]

Template for list of non-archived POIs

template_archived = 'pois/poi_list_archived.html'[source]

Template for list of archived POIs

template_engine = None[source]
property template_name: str[source]

Select correct HTML template, depending on archived flag (see TemplateResponseMixin)

Returns:

Path to HTML template

translation_model[source]

The translation model of this list view (used to determine whether machine translations are permitted)

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

  • title (TruncatingCharField) – Name of the location

  • slug (SlugField) – Link to the location. String identifier without spaces and special characters. Unique per region and language. Leave blank to generate unique parameter from title.

  • status (CharField) – Status

  • content (TextField) – Description

  • currently_in_translation (BooleanField) – Currently in translation. Flag to indicate a translation is being updated by an external translator

  • machine_translated (BooleanField) – Machine translated. Flag to indicate whether a translations is machine translated

  • version (PositiveIntegerField) – Revision

  • minor_edit (BooleanField) – Minor edit. Tick if this change does not require an update of translations in other languages.

  • last_updated (DateTimeField) – Modification date

  • automatic_translation (BooleanField) – Automatic translation. Tick if updating this content should automatically refresh or create its translations.

  • meta_description (CharField) – Meta description. Describe the location in one or two short sentences. This text will be displayed in the Google search results below the title.

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

feedback (Reverse ForeignKey from POIFeedback) – All feedback of this location translation (related name of poi_translation)

alias of POITranslation

view_is_async = False[source]

POI Version View

class integreat_cms.cms.views.pois.poi_version_view.POIVersionView(**kwargs)[source]

Bases: POIContextMixin, ContentVersionView

View for browsing the POI versions and restoring old POI versions

__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.

back_to_form_label: Promise = 'Back to the poi form'[source]

The label of the “back to form” button

content_type = None[source]
context_object_name = None[source]
dispatch(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect | TemplateResponse[source]

Validate the versions view

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

The rendered template response

Return type:

HttpResponseRedirect | TemplateResponse

property edit_url: str[source]

The url to the form in the current language

Returns:

The edit url

extra_context = None[source]
get(request, *args, **kwargs)[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]

get_context_object_name(obj)[source]

Get the name to use for the object.

get_login_url()[source]

Override this method to override the login_url attribute.

get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required()[source]

Override this method to override the permission_required attribute. Must return an iterable.

get_queryset()[source]

Filter the content objects by the current region

Raises:

Http404 – HTTP status 404 if the content is not found

Returns:

The rendered template response

Return type:

ContentQuerySet | (EventQuerySet | PageQuerySet)

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_slug_field()[source]

Get the name of a slug field to be used to look up by slug.

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.

handle_no_permission()[source]
has_change_permission() bool[source]

Whether the user has the permission to change objects

Returns:

Whether the user can change objects

Return type:

bool

has_permission() bool[source]

Override django.contrib.auth.mixins.PermissionRequiredMixin.has_permission()

Returns:

Whether the current user can access this view

Return type:

bool

has_publish_permission() bool[source]

All users who can change POIs also can publish these changes

Returns:

Whether the user can publish POIs

Return type:

bool

has_view_permission() bool[source]

Whether the user has the permission to change objects

Returns:

Whether the user can change objects

Return type:

bool

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

The current language

login_url = None[source]
model[source]

The current content model (see SingleObjectMixin)

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

  • created_date (DateTimeField) – Creation date

  • address (CharField) – Street and house number

  • postcode (CharField) – Postal code

  • city (CharField) – City

  • country (CharField) – Country

  • latitude (FloatField) – Latitude. The latitude coordinate

  • longitude (FloatField) – Longitude. The longitude coordinate

  • location_on_map (BooleanField) – Show this location on map. Tick if you want to show this location on map

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

  • website (URLField) – Website

  • email (EmailField) – Email address

  • phone_number (CharField) – Phone number

  • temporarily_closed (BooleanField) – Temporarily closed. Whether or not the location is temporarily closed. The opening hours remain and are only hidden.

  • appointment_url (URLField) – Appointment link. Link to an external website where an appointment for this location can be made.

  • opening_hours (JSONField) – Opening hours

  • barrier_free (BooleanField) – Barrier free. Indicate if the location is barrier free.

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
  • translations (Reverse ForeignKey from POITranslation) – All translations of this location (related name of poi)

  • contacts (Reverse ForeignKey from Contact) – All contacts of this location (related name of location)

  • events (Reverse ForeignKey from Event) – All events of this location (related name of location)

alias of POI

property model_name: str[source]

The name of this model

Returns:

The name of this model

object: AbstractContentModel | None = None[source]

The current content object (see SingleObjectMixin)

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

Handle responding to requests for the OPTIONS HTTP verb.

permission_denied_message = ''[source]
permission_required = None[source]
property pk_url_kwarg: str[source]

The name of the URLConf keyword argument that contains the primary key. By default, pk_url_kwarg is ‘pk’. See django.views.generic.detail.SingleObjectMixin.pk_url_kwarg.

Returns:

The name of URL kwarg of the id

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

Restore a previous revision of a page translation

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

The rendered template response

Return type:

HttpResponseRedirect

query_pk_and_slug = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
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

restore_version(restored_version: Any) None[source]

Restore the given version

Parameters:

restored_version (Any) – The version which should be restored

Return type:

None

selected_version: AbstractContentTranslation | None = None[source]

The currently selected translation version

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

Initialize attributes shared by all view methods.

slug_field = 'slug'[source]
slug_url_kwarg = 'slug'[source]
template_engine = None[source]
template_name: str = 'content_versions.html'[source]

The template to render (see TemplateResponseMixin)

translations: list[AbstractContentTranslation] = [][source]

All translations of the content object in the current language

property versions_url: str[source]

The url to the form in the current language

Returns:

The edit url

view_is_async = False[source]