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.- form_valid(form: POICategoryForm) HttpResponseRedirect [source]
Create a
POICategory
object and save all relatedPOICategoryTranslation
objects. (Seeform_valid()
)- Parameters:
form (POICategoryForm) – The valid form instance
- Returns:
A redirection to the success url
- Return type:
HttpResponseRedirect
- 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.- model[source]
alias of
POICategory
- 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
- 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
- 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_permission_required() tuple[str] [source]
Override this method to override the permission_required 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:
- 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
ForeignKey
fromPOI
) – All pois of this location category (related name ofcategory
)translations (Reverse
ForeignKey
fromPOICategoryTranslation
) – 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
- 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.- form_valid(form: POICategoryForm) HttpResponseRedirect [source]
Save all changed
POICategoryTranslation
objects. (Seeform_valid()
)- Parameters:
form (POICategoryForm) – The valid form instance
- Returns:
A redirection to the success url
- Return type:
HttpResponseRedirect
- 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