POI Categories

This package contains all views related to POI categories

POI Category Form View

class integreat_cms.cms.views.poi_categories.poi_category_form_view.POICategoryCreateView(**kwargs)[source]

Bases: POICategoryMixin, CreateView

A view that displays a formset for creating a POICategory object, redisplaying the form with validation errors (if there are any) and saving the object.

__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]
context_object_name = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = {'current_menu_item': 'poicategories'}[source]

The context dict passed to the template (see extra_context)

fields = None[source]
form_class[source]

alias of POICategoryForm

form_invalid(form: POICategoryForm) HttpResponseRedirect[source]

Renders a response, providing the invalid form as context. (see form_invalid())

Parameters:

form (POICategoryForm) – The invalid form instance

Returns:

The rendered invalid form

Return type:

HttpResponseRedirect

form_valid(form: POICategoryForm) HttpResponseRedirect[source]

Create a POICategory object and save all related POICategoryTranslation objects. (See form_valid())

Parameters:

form (POICategoryForm) – The valid form instance

Returns:

A redirection to the success url

Return type:

HttpResponseRedirect

formset: BaseInlinePOICategoryTranslationFormSet | None = None[source]

The formset of this mixin for POICategoryTranslation

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

Handle GET requests: instantiate a blank version of the form.

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

Add the formset to 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_form(form_class=None)[source]

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

get_form_class()[source]

Return the form class to use in this view.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_formset() BaseInlinePOICategoryTranslationFormSet[source]

Retrieve and instantiate the formset class

Returns:

The formset

Return type:

BaseInlinePOICategoryTranslationFormSet

get_initial()[source]

Return the initial data to use for forms on this view.

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() 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_prefix()[source]

Return the prefix to use for forms.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

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_success_url() str[source]

Determine the URL to redirect to when the form is successfully validated

Returns:

The url to redirect on success

Return type:

str

get_template_names()[source]

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

  • the value of template_name on the view (if provided)

  • the contents of the template_name_field field on the object instance that the view is operating upon (if available)

  • <app_label>/<model_name><template_name_suffix>.html

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

Override this method to customize the way permissions are checked.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
initial = {}[source]
login_url = None[source]
model[source]

alias of POICategory

object: POICategory | None = None[source]

The object instance of this SingleObjectMixin (see get_object())

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

Handle responding to requests for the OPTIONS HTTP verb.

permission_denied_message = ''[source]
permission_required = None[source]
pk_url_kwarg = 'pk'[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Check whether the formset is valid and delegate to the respective function

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefix = None[source]
put(*args, **kwargs)[source]
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

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

Initialize attributes shared by all view methods.

slug_field = 'slug'[source]
slug_url_kwarg = 'slug'[source]
success_url = None[source]
template_engine = None[source]
property template_name: str[source]

Return the template name to be used for the request.

Returns:

The template to be rendered

template_name_field = None[source]
template_name_suffix = '_form'[source]
view_is_async = False[source]
class integreat_cms.cms.views.poi_categories.poi_category_form_view.POICategoryDeleteView(*args, **kwargs)[source]

Bases: CustomDeleteView

A view that deletes an existing POICategory object or adds a helpful message on failure and redirects back to the list view.

__init__(*args, **kwargs)[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

content_type = None[source]
context_object_name = None[source]
delete(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Call the delete() method on the fetched object and then redirect to the success URL.

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Raises:

django.db.IntegrityError – If the object has many to many relationships that prevent deletion

Returns:

A redirection to the success_url

Return type:

HttpResponse

dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
form_class[source]

alias of Form

form_invalid(form)[source]

If the form is invalid, render the invalid form.

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get(request, *args, **kwargs)[source]
get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_context_object_name(obj)[source]

Get the name to use for the object.

get_form(form_class=None)[source]

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

get_form_class()[source]

Return the form class to use.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_initial()[source]

Return the initial data to use for forms on this view.

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() 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_prefix()[source]

Return the prefix to use for forms.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

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_success_url() str[source]

Determine the URL to redirect to when the object is successfully deleted

Returns:

The url to redirect on success

Return type:

str

get_template_names()[source]

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

  • the value of template_name on the view (if provided)

  • the contents of the template_name_field field on the object instance that the view is operating upon (if available)

  • <app_label>/<model_name><template_name_suffix>.html

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

Override this method to customize the way permissions are checked.

http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. Since we’re doing confirmation dynamically, we don’t need the get-request part of this view

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

alias of POICategory

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

Handle responding to requests for the OPTIONS HTTP verb.

permission_denied_message = ''[source]
permission_required = None[source]
pk_url_kwarg = 'pk'[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Attempt to delete the POICategory object and add a helpful message and redirect back to the list view on failure.

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefix = None[source]
protect_manytomany: str | None = None[source]

Whether the objects should be protected from deletion if it is used in many to many relationships

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

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

Initialize attributes shared by all view methods.

slug_field = 'slug'[source]
slug_url_kwarg = 'slug'[source]
success_url = None[source]
template_engine = None[source]
template_name = None[source]
template_name_field = None[source]
template_name_suffix = '_confirm_delete'[source]
view_is_async = False[source]
class integreat_cms.cms.views.poi_categories.poi_category_form_view.POICategoryMixin[source]

Bases: PermissionRequiredMixin, ModelTemplateResponseMixin, ModelFormMixin, SingleObjectMixin, ContextMixin

This mixin handles views for POI categories

__init__()[source]
content_type = None[source]
context_object_name = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = {'current_menu_item': 'poicategories'}[source]

The context dict passed to the template (see extra_context)

fields = None[source]
form_class[source]

The form class to instantiate

Form fields:

alias of POICategoryForm

form_invalid(form: POICategoryForm) HttpResponseRedirect[source]

Renders a response, providing the invalid form as context. (see form_invalid())

Parameters:

form (POICategoryForm) – The invalid form instance

Returns:

The rendered invalid form

Return type:

HttpResponseRedirect

form_valid(form)[source]

If the form is valid, save the associated model.

formset: BaseInlinePOICategoryTranslationFormSet | None = None[source]

The formset of this mixin for POICategoryTranslation

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

Add the formset to 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_form(form_class=None)[source]

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

get_form_class()[source]

Return the form class to use in this view.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_formset() BaseInlinePOICategoryTranslationFormSet[source]

Retrieve and instantiate the formset class

Returns:

The formset

Return type:

BaseInlinePOICategoryTranslationFormSet

get_initial()[source]

Return the initial data to use for forms on this view.

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() 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_prefix()[source]

Return the prefix to use for forms.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

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_success_url() str[source]

Determine the URL to redirect to when the form is successfully validated

Returns:

The url to redirect on success

Return type:

str

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_permission()[source]

Override this method to customize the way permissions are checked.

initial = {}[source]
login_url = None[source]
model[source]

The model of this SingleObjectMixin (see model)

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

  • icon (CharField) – Icon. Select an icon for this category

  • color (CharField) – Color. Select a color for map pins with this category

Reverse relationships:

Parameters:

alias of POICategory

object: POICategory | None = None[source]

The object instance of this SingleObjectMixin (see get_object())

permission_denied_message = ''[source]
permission_required = None[source]
pk_url_kwarg = 'pk'[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Check whether the formset is valid and delegate to the respective function

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefix = None[source]
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

slug_field = 'slug'[source]
slug_url_kwarg = 'slug'[source]
success_url = None[source]
template_engine = None[source]
property template_name: str[source]

Return the template name to be used for the request.

Returns:

The template to be rendered

class integreat_cms.cms.views.poi_categories.poi_category_form_view.POICategoryUpdateView(**kwargs)[source]

Bases: POICategoryMixin, UpdateView

A view that displays a formset for editing an existing POICategory object, redisplaying the formset with validation errors (if there are any) and saving changes to the object. This uses a form automatically generated from the object’s model class.

__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]
context_object_name = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = {'current_menu_item': 'poicategories'}[source]

The context dict passed to the template (see extra_context)

fields = None[source]
form_class[source]

alias of POICategoryForm

form_invalid(form: POICategoryForm) HttpResponseRedirect[source]

Renders a response, providing the invalid form as context. (see form_invalid())

Parameters:

form (POICategoryForm) – The invalid form instance

Returns:

The rendered invalid form

Return type:

HttpResponseRedirect

form_valid(form: POICategoryForm) HttpResponseRedirect[source]

Save all changed POICategoryTranslation objects. (See form_valid())

Parameters:

form (POICategoryForm) – The valid form instance

Returns:

A redirection to the success url

Return type:

HttpResponseRedirect

formset: BaseInlinePOICategoryTranslationFormSet | None = None[source]

The formset of this mixin for POICategoryTranslation

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

Handle GET requests: instantiate a blank version of the form.

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

Add the formset to 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_form(form_class=None)[source]

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

get_form_class()[source]

Return the form class to use in this view.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_formset() BaseInlinePOICategoryTranslationFormSet[source]

Retrieve and instantiate the formset class

Returns:

The formset

Return type:

BaseInlinePOICategoryTranslationFormSet

get_initial()[source]

Return the initial data to use for forms on this view.

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() 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_prefix()[source]

Return the prefix to use for forms.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

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_success_url() str[source]

Determine the URL to redirect to when the form is successfully validated

Returns:

The url to redirect on success

Return type:

str

get_template_names()[source]

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

  • the value of template_name on the view (if provided)

  • the contents of the template_name_field field on the object instance that the view is operating upon (if available)

  • <app_label>/<model_name><template_name_suffix>.html

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

Override this method to customize the way permissions are checked.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
initial = {}[source]
login_url = None[source]
model[source]

alias of POICategory

object: POICategory | None = None[source]

The object instance of this SingleObjectMixin (see get_object())

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

Handle responding to requests for the OPTIONS HTTP verb.

permission_denied_message = ''[source]
permission_required = None[source]
pk_url_kwarg = 'pk'[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Get the current POICategory object and save the formset

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefix = None[source]
put(*args, **kwargs)[source]
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

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

Initialize attributes shared by all view methods.

slug_field = 'slug'[source]
slug_url_kwarg = 'slug'[source]
success_url = None[source]
template_engine = None[source]
property template_name: str[source]

Return the template name to be used for the request.

Returns:

The template to be rendered

template_name_field = None[source]
template_name_suffix = '_form'[source]
view_is_async = False[source]