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.- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- extra_context = {'current_menu_item': 'placecategories'}[source]
The context dict passed to the template (see
extra_context)
- form_class[source]
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
- 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
- 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() BaseInlinePlaceCategoryTranslationFormSet[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 a list containing
template_name, if set on the value. Otherwise, return a list containing: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
PlaceCategory
- object = 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.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.- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- 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 a list containing
template_name, if set on the value. Otherwise, return a list containing: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
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
- 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.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_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:
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
- 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.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.- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- extra_context = {'current_menu_item': 'placecategories'}[source]
The context dict passed to the template (see
extra_context)
- form_class[source]
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
- 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
- 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() BaseInlinePlaceCategoryTranslationFormSet[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 a list containing
template_name, if set on the value. Otherwise, return a list containing: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
PlaceCategory
- object = None[source]
The object instance of this
SingleObjectMixin(seeget_object())
- 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
- 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