Place Categories
This package contains all views related to place categories
Place Category Form View
- class integreat_cms.cms.views.place_categories.place_category_form_view.PlaceCategoryCreateView(**kwargs)[source]
Bases:
PlaceCategoryMixin,CreateViewA view that displays a formset for creating a
PlaceCategoryobject, redisplaying the form with validation errors (if there are any) and saving the object.- form_valid(form: PlaceCategoryForm) HttpResponseRedirect[source]
Create a
PlaceCategoryobject and save all relatedPlaceCategoryTranslationobjects. (Seeform_valid())- Parameters:
form (PlaceCategoryForm) – The valid form instance
- Returns:
A redirection to the success url
- Return type:
HttpResponseRedirect
- class integreat_cms.cms.views.place_categories.place_category_form_view.PlaceCategoryDeleteView(**kwargs)[source]
Bases:
CustomDeleteViewA view that deletes an existing
PlaceCategoryobject or adds a helpful message on failure and redirects back to the list view.- model[source]
alias of
PlaceCategory
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]
Attempt to delete the
PlaceCategoryobject 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.place_categories.place_category_form_view.PlaceCategoryMixin[source]
Bases:
PermissionRequiredMixin,ModelTemplateResponseMixin,ModelFormMixin,SingleObjectMixin,ContextMixinThis mixin handles views for place categories
- extra_context = {'current_menu_item': 'placecategories'}[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
PlaceCategoryForm
- form_invalid(form: PlaceCategoryForm) HttpResponseRedirect[source]
Renders a response, providing the invalid form as context. (see
form_invalid())- Parameters:
form (PlaceCategoryForm) – The invalid form instance
- Returns:
The rendered invalid form
- Return type:
HttpResponseRedirect
- formset: BaseInlinePlaceCategoryTranslationFormSet | None = None[source]
The formset of this mixin for PlaceCategoryTranslation
- get_context_data(**kwargs: Any) dict[str, Any][source]
Add the formset to the template context (see
get_context_data()).
- get_formset() BaseInlinePlaceCategoryTranslationFormSet[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:
places (Reverse
ForeignKeyfromPlace) – All places of this place category (related name ofcategory)translations (Reverse
ForeignKeyfromPlaceCategoryTranslation) – All translations of this place category (related name ofcategory)
alias of
PlaceCategory
- object: PlaceCategory | 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.place_categories.place_category_form_view.PlaceCategoryUpdateView(**kwargs)[source]
Bases:
PlaceCategoryMixin,UpdateViewA view that displays a formset for editing an existing
PlaceCategoryobject, 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: PlaceCategoryForm) HttpResponseRedirect[source]
Save all changed
PlaceCategoryTranslationobjects. (Seeform_valid())- Parameters:
form (PlaceCategoryForm) – 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
PlaceCategoryobject 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