Eventsο
This package contains all views related to events
Event Actionsο
This module contains action methods for events (archive, restore, β¦)
- integreat_cms.cms.views.events.event_actions.archive(request: HttpRequest, event_id: int, region_slug: str, language_slug: str) HttpResponseRedirect [source]ο
Set archived flag for an event
- Parameters:
- Returns:
The rendered template response
- Return type:
HttpResponseRedirect
- integreat_cms.cms.views.events.event_actions.copy(request: HttpRequest, event_id: int, region_slug: str, language_slug: str) HttpResponseRedirect [source]ο
Duplicates the given event and all of its translations.
- Parameters:
- Returns:
The rendered template response
- Return type:
HttpResponseRedirect
- integreat_cms.cms.views.events.event_actions.delete(request: HttpRequest, event_id: int, region_slug: str, language_slug: str) HttpResponseRedirect [source]ο
Delete a single event
- Parameters:
- Returns:
The rendered template response
- Return type:
HttpResponseRedirect
- integreat_cms.cms.views.events.event_actions.restore(request: HttpRequest, event_id: int, region_slug: str, language_slug: str) HttpResponseRedirect [source]ο
Remove archived flag for an event
- Parameters:
- Returns:
The rendered template response
- Return type:
HttpResponseRedirect
- integreat_cms.cms.views.events.event_actions.search_poi_ajax(request: HttpRequest, region_slug: str) HttpResponse [source]ο
AJAX endpoint for searching POIs
- Parameters:
request (HttpRequest) β Object representing the user call
region_slug (str)
- Returns:
The rendered template response
- Return type:
HttpResponse
Event Context Mixinο
- class integreat_cms.cms.views.events.event_context_mixin.EventContextMixin[source]ο
Bases:
ContextMixin
This mixin provides extra context for event views
Event Form Viewο
- class integreat_cms.cms.views.events.event_form_view.EventFormView(**kwargs)[source]ο
Bases:
TemplateView
,EventContextMixin
,MediaContextMixin
,ContentEditLockMixin
Class for rendering the events form
- __init__(**kwargs)[source]ο
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- back_url_name: str | None = 'events'[source]ο
The url name of the view to show if the user decides to go back (see
ContentEditLockMixin
- 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 event form for HTTP GET requests
- Parameters:
request (HttpRequest) β Object representing the user call
*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()
).
- 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.
- http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]ο
- options(request, *args, **kwargs)[source]ο
Handle responding to requests for the OPTIONS HTTP verb.
- post(request: HttpRequest, **kwargs: Any) HttpResponse [source]ο
Save event and ender event form for HTTP POST requests
- Parameters:
request (HttpRequest) β Object representing the user call
**kwargs (Any) β The supplied keyword arguments
- Raises:
PermissionDenied β If user does not have the permission to publish events
- 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 = 'events/event_form.html'[source]ο
The template to render (see
TemplateResponseMixin
)
Event List Viewο
- class integreat_cms.cms.views.events.event_list_view.EventListView(**kwargs)[source]ο
Bases:
TemplateView
,EventContextMixin
,MachineTranslationContextMixin
View for listing events (either non-archived or archived events depending on
archived
)- __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 events list for HTTP GET requests
- Parameters:
request (HttpRequest) β Object representing the user call
*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()
).
- 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.
- http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]ο
- options(request, *args, **kwargs)[source]ο
Handle responding to requests for the OPTIONS HTTP verb.
- 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
- translation_model[source]ο
The translation model of this list view (used to determine whether machine translations are permitted)
- Parameters:
id (BigAutoField) β Primary key: ID
title (TruncatingCharField) β Title of the event
slug (SlugField) β Event link. String identifier without spaces and special characters. Unique per region and language. Leave blank to generate unique parameter from title.
status (CharField) β Status
content (TextField) β Description
currently_in_translation (BooleanField) β Currently in translation. Flag to indicate a translation is being updated by an external translator
machine_translated (BooleanField) β Machine translated. Flag to indicate whether a translations is machine translated
version (PositiveIntegerField) β Revision
minor_edit (BooleanField) β Minor edit. Tick if this change does not require an update of translations in other languages.
last_updated (DateTimeField) β Modification date
automatic_translation (BooleanField) β Automatic translation. Tick if updating this content should automatically refresh or create its translations.
Relationship fields:
- Parameters:
language (
ForeignKey
toLanguage
) β Language (related name:event_translations
)creator (
ForeignKey
toUser
) β Creator (related name:event_translations
)event (
ForeignKey
toEvent
) β Event (related name:translations
)links (
GenericRelation
toLink
) β Links (related name:event_translation
)
Reverse relationships:
- Parameters:
feedback (Reverse
ForeignKey
fromEventFeedback
) β All feedback of this event translation (related name ofevent_translation
)
alias of
EventTranslation
Event Version Viewο
- class integreat_cms.cms.views.events.event_version_view.EventVersionView(**kwargs)[source]ο
Bases:
EventContextMixin
,ContentVersionView
View for browsing the event versions and restoring old event 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 event 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=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()[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]ο
Whether the user has the permission to publish objects
- Returns:
Whether the user can publish objects
- 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:
- http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]ο
- model[source]ο
The current content model (see
SingleObjectMixin
)- Parameters:
id (BigAutoField) β Primary key: ID
created_date (DateTimeField) β Creation date
start (DateTimeField) β Start
end (DateTimeField) β End
only_weekdays (BooleanField) β Only Mondays to Fridays. Tick if this event takes place only on Monday through Friday
archived (BooleanField) β Archived
external_event_id (CharField) β The ID of this event in the external calendar
Relationship fields:
- Parameters:
region (
ForeignKey
toRegion
) β Region (related name:events
)location (
ForeignKey
toPOI
) β Location (related name:events
)recurrence_rule (
OneToOneField
toRecurrenceRule
) βRecurrence rule (related name:
event
)If the event is recurring, the recurrence rule contains all necessary information on the frequency, interval etc. which is needed to calculate the single instances of a recurring event
icon (
ForeignKey
toMediaFile
) β Icon (related name:events
)external_calendar (
ForeignKey
toExternalCalendar
) β External calendar (related name:events
)
Reverse relationships:
- Parameters:
translations (Reverse
ForeignKey
fromEventTranslation
) β All translations of this event (related name ofevent
)
alias of
Event
- object: AbstractContentModel | None = None[source]ο
The current content object (see
SingleObjectMixin
)
- options(request, *args, **kwargs)[source]ο
Handle responding to requests for the OPTIONS HTTP verb.
- 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