Language Tree

This package contains all views related to the language tree of a region

Language Tree Actions

This module contains view actions for the language tree. Typically, they do not render a whole page, but only parts of it or they redirect to regular views.

integreat_cms.cms.views.language_tree.language_tree_actions.delete_language_tree_node(request: HttpRequest, region_slug: str, pk: int) HttpResponseRedirect[source]

Deletes the language node of distinct region and all page translations for this language

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the region which language node should be deleted

  • pk (int) – The id of the language tree node which should be deleted

Returns:

A redirection to the language tree

Return type:

HttpResponseRedirect

integreat_cms.cms.views.language_tree.language_tree_actions.manually_invalidate_models(region: Region) None[source]

This is a helper function to iterate through all affected objects and invalidate their cache. This is necessary as the original cache invalidation of cacheops only triggers for direct foreign key relationships.

Parameters:

region (Region) – The affected region

Return type:

None

integreat_cms.cms.views.language_tree.language_tree_actions.move_language_tree_node(request: HttpRequest, region_slug: str, pk: int, target_id: int, target_position: str) HttpResponseRedirect[source]

This action moves the given language tree node to the given position relative to the given target.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the region which language tree should be modified

  • pk (int) – The id of the language tree node which should be moved

  • target_id (int) – The id of the target language tree node

  • target_position (str) – The desired position (choices: position)

Returns:

A redirection to the language tree

Return type:

HttpResponseRedirect

Language Tree Bulk Actions

class integreat_cms.cms.views.language_tree.language_tree_bulk_actions.BulkActivateView(**kwargs)[source]

Bases: LanguageTreeBulkActionView

Bulk action for activating multiple language tree nodes at once

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

action = 'activated'[source]

The name of the action

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
field_name = 'active'[source]

The name of the archived-field

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

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Get extra filters for get_queryset(). Overwrite this method to specify needed filters e.g. as in ~integreat_cms.cms.views.contact.contact_bulk_actions

Returns:

Q Object to be used as filter argument

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

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

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

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

Returns:

url to redirect to

Return type:

str

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

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

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

alias of LanguageTreeNode

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Execute bulk action for language tree node and flush the cache

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
value: bool = True[source]

The value of the field (defaults to True)

view_is_async = False[source]
class integreat_cms.cms.views.language_tree.language_tree_bulk_actions.BulkDisableView(**kwargs)[source]

Bases: BulkActivateView

Bulk action for disabling multiple language tree nodes at once

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

action = 'disabled'[source]

The name of the action

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
field_name = 'active'[source]

The name of the archived-field

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

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Get extra filters for get_queryset(). Overwrite this method to specify needed filters e.g. as in ~integreat_cms.cms.views.contact.contact_bulk_actions

Returns:

Q Object to be used as filter argument

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

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

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

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

Returns:

url to redirect to

Return type:

str

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

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

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

alias of LanguageTreeNode

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Execute bulk action for language tree node and flush the cache

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
value: bool = False[source]

The value of the field

view_is_async = False[source]
class integreat_cms.cms.views.language_tree.language_tree_bulk_actions.BulkHideView(**kwargs)[source]

Bases: BulkMakeVisibleView

Bulk action for hiding multiple language tree nodes at once

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

action = 'hidden'[source]

The name of the action

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
field_name = 'visible'[source]

The name of the archived-field

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

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Get extra filters for get_queryset(). Overwrite this method to specify needed filters e.g. as in ~integreat_cms.cms.views.contact.contact_bulk_actions

Returns:

Q Object to be used as filter argument

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

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

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

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

Returns:

url to redirect to

Return type:

str

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

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

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

alias of LanguageTreeNode

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Execute bulk action for language tree node and flush the cache

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
value: bool = False[source]

The value of the field

view_is_async = False[source]
class integreat_cms.cms.views.language_tree.language_tree_bulk_actions.BulkMakeVisibleView(**kwargs)[source]

Bases: LanguageTreeBulkActionView

Bulk action for making multiple language tree nodes visible at once

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

action = 'made visible'[source]

The name of the action

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
field_name = 'visible'[source]

The name of the archived-field

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

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Get extra filters for get_queryset(). Overwrite this method to specify needed filters e.g. as in ~integreat_cms.cms.views.contact.contact_bulk_actions

Returns:

Q Object to be used as filter argument

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

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

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

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

Returns:

url to redirect to

Return type:

str

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

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

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

alias of LanguageTreeNode

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Execute bulk action for language tree node and flush the cache

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
value: bool = True[source]

The value of the field (defaults to True)

view_is_async = False[source]
class integreat_cms.cms.views.language_tree.language_tree_bulk_actions.LanguageTreeBulkActionView(**kwargs)[source]

Bases: BulkUpdateBooleanFieldView

Bulk action view for language tree nodes which flushes the cache for all content models after each operation

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

property action: str[source]

Called when the bulk action is performed and the action attribute was not overwritten

Raises:

NotImplementedError – If the action attribute is not implemented in the subclass

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
property field_name: str[source]

Called when the bulk action is performed and the field_name attribute was not overwritten

Raises:

NotImplementedError – If the field_name attribute is not implemented in the subclass

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

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_extra_filters() Q[source]

Get extra filters for get_queryset(). Overwrite this method to specify needed filters e.g. as in ~integreat_cms.cms.views.contact.contact_bulk_actions

Returns:

Q Object to be used as filter argument

Return type:

Q

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

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

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

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

Returns:

url to redirect to

Return type:

str

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

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

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

The model of this BulkActionView

Parameters:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

children (Reverse ForeignKey from LanguageTreeNode) – All children of this language tree node (related name of parent)

alias of LanguageTreeNode

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Execute bulk action for language tree node and flush the cache

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

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

Returns:

The redirect

Return type:

HttpResponseRedirect

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = True[source]

Whether the view requires change permissions

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

Initialize attributes shared by all view methods.

url = None[source]
value: bool = True[source]

The value of the field (defaults to True)

view_is_async = False[source]

Language Tree Context Mixin

class integreat_cms.cms.views.language_tree.language_tree_context_mixin.LanguageTreeContextMixin[source]

Bases: ContextMixin

This mixin provides extra context for language tree views

__init__()[source]
extra_context = None[source]
get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

Language Tree Node Form View

class integreat_cms.cms.views.language_tree.language_tree_node_form_view.LanguageTreeNodeCreateView(**kwargs)[source]

Bases: CustomCreateView

Class that handles creating language tree nodes. This view is available within regions.

__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 = None[source]
fields = None[source]
form_class[source]

The form class of this form view

Form fields:

alias of LanguageTreeNodeForm

form_invalid(form: CustomModelForm) HttpResponse[source]

Renders a response, providing the invalid form as context.

Parameters:

form (CustomModelForm) – The invalid form instance

Returns:

The rendered invalid form

Return type:

HttpResponse

form_valid(form: CustomModelForm) HttpResponseRedirect[source]

Saves the form instance, sets the current object for the view, and redirects to get_success_url().

Parameters:

form (CustomModelForm) – 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]

Returns a dictionary representing 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() dict[str, Any][source]

Return the keyword arguments for instantiating the form

Returns:

The form kwargs

Return type:

dict[str, Any]

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.

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]
property model: ModelBase[source]

Return the model class of this form mixin

Returns:

The corresponding Django model

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, *args, **kwargs)[source]

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

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_suffix: str = '_form'[source]

The suffix to append to the auto-generated candidate template name.

view_is_async = False[source]
class integreat_cms.cms.views.language_tree.language_tree_node_form_view.LanguageTreeNodeUpdateView(**kwargs)[source]

Bases: CustomUpdateView

Class that handles activating/deactivating of a language tree node

__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 = None[source]
fields = None[source]
form_class = None[source]
form_invalid(form: CustomModelForm) HttpResponse[source]

Renders a response, providing the invalid form as context.

Parameters:

form (CustomModelForm) – The invalid form instance

Returns:

The rendered invalid form

Return type:

HttpResponse

form_valid(form: LanguageTreeNodeForm) HttpResponseRedirect[source]

Saves the form instance, sets the current object for the view, and redirects to get_success_url().

Parameters:

form (LanguageTreeNodeForm) – 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]

Returns a dictionary representing 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() dict[str, Any][source]

Return the keyword arguments for instantiating the form

Returns:

The form kwargs

Return type:

dict[str, Any]

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.

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]
property model: ModelBase[source]

Return the model class of this form mixin

Returns:

The corresponding Django model

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, *args, **kwargs)[source]

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

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_suffix: str = '_form'[source]

The suffix to append to the auto-generated candidate template name.

view_is_async = False[source]

Language Tree View

class integreat_cms.cms.views.language_tree.language_tree_view.LanguageTreeView(**kwargs)[source]

Bases: LanguageTreeContextMixin, ModelListView

View for rendering the language tree view. This view is available in regions.

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

content_type = None[source]
property context_object_name: str[source]

Designates the name of the variable to use in the context (see MultipleObjectMixin).

Returns:

The name of the objects in this list view

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

Return True if the view should display empty lists and False if a 404 should be raised instead.

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

Returns a dictionary representing 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(object_list)[source]

Get the name of the item to be used in the context.

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

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_queryset() list[LanguageTreeNode][source]

Get language tree queryset

Returns:

The language tree of the current region

Return type:

list[LanguageTreeNode]

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

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.

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

The model of this list view

Parameters:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

children (Reverse ForeignKey from LanguageTreeNode) – All children of this language tree node (related name of parent)

alias of LanguageTreeNode

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

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by: int | None = None[source]

Disable pagination for language tree

paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

permission_denied_message = ''[source]
permission_required = None[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.

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_suffix = '_list'[source]
view_is_async = False[source]