Imprint
This package contains all views related to the imprint
Imprint Actions
This module contains view actions related to the imprint.
- integreat_cms.cms.views.imprint.imprint_actions.delete_imprint(request: HttpRequest, region_slug: str) HttpResponseRedirect [source]
Delete imprint object
- Parameters:
request (HttpRequest) – The current request
region_slug (str) – The slug of the current region
- Raises:
Http404 – If no imprint exists for the region
- Returns:
A redirection to the
ImprintFormView
- Return type:
HttpResponseRedirect
- integreat_cms.cms.views.imprint.imprint_actions.expand_imprint_translation_id(request: HttpRequest, imprint_translation_id: int) HttpResponseRedirect | HttpResponseNotFound [source]
Searches for an imprint translation with corresponding ID and redirects browser to web app
- Parameters:
request (HttpRequest) – The current request
imprint_translation_id (int) – The id of the requested imprint translation
- Returns:
A redirection to
WEBAPP_URL
- Return type:
HttpResponseRedirect | HttpResponseNotFound
Imprint Context Mixin
- class integreat_cms.cms.views.imprint.imprint_context_mixin.ImprintContextMixin[source]
Bases:
ContextMixin
This mixin provides extra context for imprint views
Imprint Form View
- class integreat_cms.cms.views.imprint.imprint_form_view.ImprintFormView(**kwargs)[source]
Bases:
TemplateView
,ImprintContextMixin
,MediaContextMixin
View for the imprint page form and imprint page translation form
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- extra_context = {'translation_status': <module 'integreat_cms.cms.constants.translation_status' from '/home/circleci/project/integreat_cms/cms/constants/translation_status.py'>}[source]
The context dict passed to the template (see
ContextMixin
)
- get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Render
ImprintTranslationForm
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
The rendered template response
- Return type:
HttpResponse
- get_context_data(**kwargs: Any) dict[str, Any] [source]
Returns a dictionary representing the template context (see
get_context_data()
).
- static get_side_by_side_language_options(region: Region, language: Language, imprint: ImprintPage | None) list[dict[str, Any]] [source]
This is a helper function to generate the side-by-side language options for both the get and post requests.
- 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.
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Binds the user input data to the imprint form and validates the input. Forms containing images/files need to be additionally instantiated with the FILES attribute of request objects, see File Uploads
- Parameters:
request (HttpRequest) – Request submitted for saving imprint form
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
Redirection to the populated imprint form
- Return type:
HttpResponse
- 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
- template_name = 'imprint/imprint_form.html'[source]
The template to render (see
TemplateResponseMixin
)
Imprint Sbs View
- class integreat_cms.cms.views.imprint.imprint_sbs_view.ImprintSideBySideView(**kwargs)[source]
Bases:
TemplateView
,ImprintContextMixin
,MediaContextMixin
View for the imprint side by side form
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Render
ImprintTranslationForm
on the side by side view- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Raises:
Http404 – If no imprint exists for the region
- Returns:
The rendered template response
- Return type:
HttpResponse
- get_context_data(**kwargs: Any) dict[str, Any] [source]
Returns a dictionary representing the template context (see
get_context_data()
).
- 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.
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Submit
ImprintTranslationForm
and saveImprintPageTranslation
object- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Raises:
Http404 – If no imprint exists for the region
- Returns:
The rendered template response
- Return type:
HttpResponse
- 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
- template_name = 'imprint/imprint_sbs.html'[source]
The template to render (see
TemplateResponseMixin
)
- integreat_cms.cms.views.imprint.imprint_sbs_view.get_old_source_content(imprint: ImprintPage, source_language: Language, target_language: Language) str [source]
This function returns the content of the source language translation that was up to date when the latest (no minor edit) target language translation was created.
- Parameters:
imprint (ImprintPage) – The imprint
source_language (Language) – The source language of the imprint
target_language (Language) – The target language of the imprint
- Returns:
The content of the translation
- Return type:
Imprint Version View
- class integreat_cms.cms.views.imprint.imprint_version_view.ImprintVersionView(**kwargs)[source]
Bases:
ImprintContextMixin
,ContentVersionView
View for browsing the imprint versions and restoring old imprint versions
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- back_to_form_label: Promise = 'Back to the imprint form'[source]
The label of the “back to form” button
- dispatch(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect | TemplateResponse [source]
Validate the versions view
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Raises:
PermissionDenied – If user does not have the permission to edit the specific page
- Returns:
The rendered template response
- Return type:
HttpResponseRedirect | TemplateResponse
- get_context_data(**kwargs: Any) dict[str, Any] [source]
Returns a dictionary representing the template context (see
get_context_data()
).
- get_object(queryset: Any | None = None) ImprintPage [source]
Get the current imprint object
- Raises:
Http404 – HTTP status 404 if the imprint is not found
- Returns:
The imprint object
- Parameters:
queryset (Any | None)
- Return type:
- get_permission_denied_message()[source]
Override this method to override the permission_denied_message attribute.
- get_permission_required()[source]
Override this method to override the permission_required attribute. Must return an iterable.
- get_queryset()[source]
Filter the content objects by the current region
- Raises:
Http404 – HTTP status 404 if the content is not found
- Returns:
The rendered template response
- Return type:
- 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.
- has_change_permission() bool [source]
Whether the user has the permission to change objects
- Returns:
Whether the user can change objects
- Return type:
- has_permission() bool [source]
Override
django.contrib.auth.mixins.PermissionRequiredMixin.has_permission()
- Returns:
Whether the current user can access this view
- Return type:
- has_publish_permission() bool [source]
All users who can change the imprint also can publish these changes
- Returns:
Whether the user can publish the imprint
- Return type:
- has_view_permission() bool [source]
Whether the user has the permission to change objects
- Returns:
Whether the user can change objects
- Return type:
- model[source]
The current content model (see
SingleObjectMixin
)- Parameters:
id (BigAutoField) – Primary key: ID
created_date (DateTimeField) – Creation date
Relationship fields:
- Parameters:
region (
ForeignKey
toRegion
) – Region (related name:imprints
)
Reverse relationships:
- Parameters:
translations (Reverse
ForeignKey
fromImprintPageTranslation
) – All translations of this imprint (related name ofpage
)
alias of
ImprintPage
- object: AbstractContentModel | None = None[source]
The current content object (see
SingleObjectMixin
)
- property pk_url_kwarg: str[source]
The name of the URLConf keyword argument that contains the primary key. By default, pk_url_kwarg is ‘pk’. See
django.views.generic.detail.SingleObjectMixin.pk_url_kwarg
.- Returns:
The name of URL kwarg of the id
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect [source]
Restore a previous revision of a page translation
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Raises:
PermissionDenied – If user does not have the permission to edit the specific page
- Returns:
The rendered template response
- 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
- restore_version(restored_version: Any) None [source]
Restore the given version
- Parameters:
restored_version (Any) – The version which should be restored
- Return type:
None
- selected_version: AbstractContentTranslation | None = None[source]
The currently selected translation version
- template_name: str = 'content_versions.html'[source]
The template to render (see
TemplateResponseMixin
)
- translations: list[AbstractContentTranslation] = [][source]
All translations of the content object in the current language