Media

This package contains all views related to media files

Media Actions

This module contains view actions for media related objects.

integreat_cms.cms.views.media.media_actions.create_directory_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View provides the frontend with the option to create a directory via AJAX.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.delete_directory_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View provides the frontend with the option to delete a directory via AJAX.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.delete_file_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View to delete a file via an AJAX call.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.edit_directory_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View provides the frontend with the option to modify a directory via AJAX.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.edit_file_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View provides the edit of a file via AJAX.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.get_directory_content_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View provides the frontend with the content of a directory via AJAX.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.get_directory_path_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View provides the frontend with the current directory path for the breadcrumbs.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.get_file_usages_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View to search unused media files

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response with the search result

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.get_query_search_results_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View to search the media library

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response with the search result

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.get_unused_media_files_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View to search unused media files

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response with the search result

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.move_file_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

This view provides the frontend with the option to move files via AJAX.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.replace_file_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View provides the replacement of a file via AJAX.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

integreat_cms.cms.views.media.media_actions.upload_file_ajax(request: HttpRequest, region_slug: str | None = None) JsonResponse[source]

View to create a file via an AJAX upload.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str | None) – The slug of the current region

Returns:

JSON response which indicates error or success

Return type:

JsonResponse

Media Context Mixin

class integreat_cms.cms.views.media.media_context_mixin.MediaContextMixin[source]

Bases: ContextMixin

This mixin provides context data required by the the media library.

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

Overwrites the default get_context_data() Method of Django to provide an additional context for template rendering.

Parameters:

**kwargs (Any) – The supplied keyword arguments

Returns:

The overwritten context.

Return type:

dict[str, Any]

Media List View

The module is working as the view component for the dynamic data loading for the media library. Therefore, it’s managing the region permissions and connects the different data structures. Especially, the root file, the use of the file defined in the Document and the different meta data.

class integreat_cms.cms.views.media.media_list_view.AdminMediaListView(**kwargs)[source]

Bases: TemplateView, MediaContextMixin

Class representing the media management and renders the dynamic data into the HTML template.

extra_context = {'current_menu_item': 'media'}[source]

The context dict passed to the template (see ContextMixin)

class integreat_cms.cms.views.media.media_list_view.MediaListView(**kwargs)[source]

Bases: TemplateView, MediaContextMixin

Class representing the media management and renders the dynamic data into the HTML template.

extra_context = {'current_menu_item': 'media'}[source]

The context dict passed to the template (see ContextMixin)

template_name = 'media/media_list.html'[source]

The template to render (see TemplateResponseMixin)