calingen.views.event
¶
Views related to the calingen.models.event.Event
model.
Module Contents¶
Classes¶
Generic class-based view implementation to add |
|
Generic class-based view implementation to delete |
|
Provide details of a |
|
Provide a list of |
|
Generic class-based view implementation to update |
- class calingen.views.event.EventCreateView(**kwargs)¶
Bases:
django.contrib.auth.mixins.LoginRequiredMixin
,calingen.views.mixins.ProfileIDMixin
,django.views.generic.CreateView
Generic class-based view implementation to add
calingen.models.event.Event
objects.Notes
This implementation uses Django’s generic class-based view
django.views.generic.CreateView
.The view relies on
calingen.models.event.EventForm
as itsModelForm
. This is required to make custom validation logic available.- form_class¶
Specify which form to use.
- model¶
Required attribute to tie this view to the model.
- success_url¶
The URL to redirect to after successfully creating the instance.
- template_name_suffix = _create¶
Make the view use the template
calingen/event_create.html
.
- form_valid(form)¶
Inject the user’s
Profile
into the form.Every user does have only one
Profile
andEvent
instances are directly tied to thatProfile
.The
EventForm`
does not include the field to select theProfile
, as user’s are only allowed to createEvent
instances for themselves.This method injects the user’s
Profile
into theform.instance
to maintain database integrity.
- class calingen.views.event.EventDeleteView(*args, **kwargs)¶
Bases:
calingen.views.mixins.RestrictToUserMixin
,django.contrib.auth.mixins.LoginRequiredMixin
,calingen.views.mixins.ProfileIDMixin
,django.views.generic.DeleteView
Generic class-based view implementation to delete
calingen.models.event.Event
objects.Notes
This implementation uses Django’s generic class-based view
django.views.generic.DeleteView
.- context_object_name = event_item¶
Provide a semantic name for the built-in context.
- model¶
Required attribute to tie this view to the model.
- pk_url_kwarg = event_id¶
The name of the keyword argument as provided in the app’s url configuration.
By default, this is simply
"pk"
, but for clarity, the app’s url configuration (calingen.urls
) uses the more explicit"event_id"
.
- success_url¶
The URL to redirect to after successfully deleting the instance.
- class calingen.views.event.EventDetailView(**kwargs)¶
Bases:
calingen.views.mixins.RestrictToUserMixin
,django.contrib.auth.mixins.LoginRequiredMixin
,calingen.views.mixins.ProfileIDMixin
,django.views.generic.DetailView
Provide details of a
calingen.models.event.Event
instance.Notes
This implementation uses Django’s generic class-based view
django.views.generic.DetailView
.- context_object_name = event_item¶
Provide a semantic name for the built-in context.
- model¶
Required attribute to tie this view to the model.
- pk_url_kwarg = event_id¶
The name of the keyword argument as provided in the app’s url configuration.
By default, this is simply
"pk"
, but for clarity, the app’s url configuration (calingen.urls
) uses the more explicit"event_id"
.
- class calingen.views.event.EventListView(**kwargs)¶
Bases:
calingen.views.mixins.RestrictToUserMixin
,django.contrib.auth.mixins.LoginRequiredMixin
,calingen.views.mixins.ProfileIDMixin
,django.views.generic.ListView
Provide a list of
calingen.models.event.Event
instances.Notes
This implementation uses Django’s generic class-based view
django.views.generic.ListView
.- context_object_name = event_list¶
Provide a semantic name for the built-in context.
- model¶
Required attribute to tie this view to the model.
- class calingen.views.event.EventUpdateView(**kwargs)¶
Bases:
calingen.views.mixins.RestrictToUserMixin
,django.contrib.auth.mixins.LoginRequiredMixin
,calingen.views.mixins.ProfileIDMixin
,django.views.generic.UpdateView
Generic class-based view implementation to update
calingen.models.event.Event
objects.Notes
This implementation uses Django’s generic class-based view
django.views.generic.UpdateView
.The view relies on
calingen.models.event.EventForm
as itsModelForm
. This is required to make custom validation logic available.- form_class¶
Specify which form to use.
- model¶
Required attribute to tie this view to the model.
- pk_url_kwarg = event_id¶
The name of the keyword argument as provided in the app’s url configuration.
By default, this is simply
"pk"
, but for clarity, the app’s url configuration (calingen.urls
) uses the more explicit"event_id"
.
- success_url¶
The URL to redirect to after successfully updating the instance.
- template_name_suffix = _update¶
Make the view use the template
calingen/event_update.html
.