calingen.views.profile¶
Views related to the calingen.models.profile.Profile model.
Module Contents¶
Classes¶
Generic class-based view implementation to add |
|
Generic class-based view implementation to delete |
|
Provide details of a |
|
Generic class-based view implementation to add |
- class calingen.views.profile.ProfileCreateView(**kwargs)¶
Bases:
django.contrib.auth.mixins.LoginRequiredMixin,django.views.generic.CreateViewGeneric class-based view implementation to add
calingen.models.profile.Profileobjects.Notes
This implementation uses Django’s generic class-based view
django.views.generic.CreateView.- fields = []¶
The fields to include into the form.
This list is left empty, as the creation of the
Profileinstance is a one-off operation, simply tying the instance to an existingUserof the Django project.
- model¶
Required attribute to tie this view to the model.
- template_name_suffix = _create¶
Make the view use the template
calingen/profile_create.html.
- form_valid(form)¶
Handle database integrity errors.
Notes
The view relies on an automatically generated instance of Django’s
ModelFormwithout any fields. Thus, validation of theformis a given, as therequest.useris injected after form validation.However, the
Profilehas a 1:1 relation with the project’sAUTH_USER_MODEL, so trying to create multiple instances ofProfilefor the same user will raise anIntegrityError.If the
IntegrityErroris catched, the user will be redirected to his profile page.
- class calingen.views.profile.ProfileDeleteView(*args, **kwargs)¶
Bases:
django.contrib.auth.mixins.LoginRequiredMixin,calingen.views.mixins.RestrictToUserMixin,calingen.views.mixins.ProfileIDMixin,django.views.generic.DeleteViewGeneric class-based view implementation to delete
calingen.models.profile.Profileobjects.Notes
This implementation uses Django’s generic class-based view
django.views.generic.DeleteView.- context_object_name = profile_item¶
Provide a semantic name for the built-in context.
- model¶
Required attribute to tie this view to the model.
- pk_url_kwarg = profile_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"profile_id".
- success_url¶
The URL to redirect to after successfully deleting the instance.
Warning
As of now, this redirect to the page to create a profile. This must be adjusted, once the real estimated flows are implemented with all required views.
- class calingen.views.profile.ProfileDetailView(**kwargs)¶
Bases:
django.contrib.auth.mixins.LoginRequiredMixin,calingen.views.mixins.RestrictToUserMixin,calingen.views.mixins.ProfileIDMixin,django.views.generic.DetailViewProvide details of a
calingen.models.profile.Profileinstance.Notes
This implementation uses Django’s generic class-based view
django.views.generic.DetailView.- context_object_name = profile¶
Provide a semantic name for the built-in context.
- model¶
Required attribute to tie this view to the model.
- pk_url_kwarg = profile_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".
- get_context_data(**kwargs)¶
Just for linting.
- class calingen.views.profile.ProfileUpdateView(**kwargs)¶
Bases:
calingen.views.mixins.RestrictToUserMixin,django.contrib.auth.mixins.LoginRequiredMixin,calingen.views.mixins.ProfileIDMixin,django.views.generic.UpdateViewGeneric class-based view implementation to add
calingen.models.profile.Profileobjects.Notes
This implementation uses Django’s generic class-based view
django.views.generic.CreateView.- form_class¶
Specify which form to use.
- model¶
Required attribute to tie this view to the model.
- pk_url_kwarg = profile_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"profile_id".
- template_name_suffix = _update¶
Make the view use the template
calingen/profile_update.html.
- get_context_data(**kwargs)¶
Provide additional context for this view, depending on app-specific settings.
While accessing the users
Profile, its list ofevent_provideris updated. If there are providers, that are moved fromactivetounavailable, the user is informed using Django’smessagesframework.This is dependent on the setting
CALINGEN_MISSING_EVENT_PROVIDER_NOTIFICATION.