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,CreateViewA view that displays a formset for creating a
POICategoryobject, 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.
- extra_context = {'current_menu_item': 'poicategories'}[source]
The context dict passed to the template (see
extra_context)
- 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
POICategoryobject and save all relatedPOICategoryTranslationobjects. (Seeform_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()).
- get_formset() BaseInlinePOICategoryTranslationFormSet[source]
Retrieve and instantiate the formset class
- Returns:
The formset
- Return type:
- 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.
- 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_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:
- 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_nameon the view (if provided)the contents of the
template_name_fieldfield on the object instance that the view is operating upon (if available)<app_label>/<model_name><template_name_suffix>.html
- model[source]
alias of
POICategory
- object: POICategory | None = None[source]
The object instance of this
SingleObjectMixin(seeget_object())
- 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
- 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
- class integreat_cms.cms.views.poi_categories.poi_category_form_view.POICategoryDeleteView(*args, **kwargs)[source]
Bases:
CustomDeleteViewA view that deletes an existing
POICategoryobject or adds a helpful message on failure and redirects back to the list view.- 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
- 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.
- 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_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:
- 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_nameon the view (if provided)the contents of the
template_name_fieldfield on the object instance that the view is operating upon (if available)<app_label>/<model_name><template_name_suffix>.html
- 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
- model[source]
alias of
POICategory
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]
Attempt to delete the
POICategoryobject 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
- protect_manytomany: str | None = None[source]
Whether the objects should be protected from deletion if it is used in many to many relationships
- 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
- class integreat_cms.cms.views.poi_categories.poi_category_form_view.POICategoryMixin[source]
Bases:
PermissionRequiredMixin,ModelTemplateResponseMixin,ModelFormMixin,SingleObjectMixin,ContextMixinThis mixin handles views for POI categories
- extra_context = {'current_menu_item': 'poicategories'}[source]
The context dict passed to the template (see
extra_context)
- form_class[source]
The form class to instantiate
Form fields:
icon: Icon (TypedChoiceField)color: Color (TypedChoiceField)
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
- 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()).
- get_formset() BaseInlinePOICategoryTranslationFormSet[source]
Retrieve and instantiate the formset class
- Returns:
The formset
- Return type:
- 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.
- 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_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:
- 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.
- model[source]
The model of this
SingleObjectMixin(seemodel)- 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:
pois (Reverse
ForeignKeyfromPOI) – All pois of this location category (related name ofcategory)translations (Reverse
ForeignKeyfromPOICategoryTranslation) – All translations of this location category (related name ofcategory)
alias of
POICategory
- object: POICategory | None = None[source]
The object instance of this
SingleObjectMixin(seeget_object())
- 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
- 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
- class integreat_cms.cms.views.poi_categories.poi_category_form_view.POICategoryUpdateView(**kwargs)[source]
Bases:
POICategoryMixin,UpdateViewA view that displays a formset for editing an existing
POICategoryobject, 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.
- extra_context = {'current_menu_item': 'poicategories'}[source]
The context dict passed to the template (see
extra_context)
- 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
POICategoryTranslationobjects. (Seeform_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()).
- get_formset() BaseInlinePOICategoryTranslationFormSet[source]
Retrieve and instantiate the formset class
- Returns:
The formset
- Return type:
- 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.
- 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_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:
- 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_nameon the view (if provided)the contents of the
template_name_fieldfield on the object instance that the view is operating upon (if available)<app_label>/<model_name><template_name_suffix>.html
- model[source]
alias of
POICategory
- object: POICategory | None = None[source]
The object instance of this
SingleObjectMixin(seeget_object())
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]
Get the current
POICategoryobject 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
- 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