loefsys.events.views module
Module defining the views for events.
- class loefsys.events.views.EventDetailView(**kwargs)
Bases:
LoginRequiredMixin,DetailViewView for viewing an event.
- queryset
- template_name = 'events/event.html'
- get_context_data(**kwargs)
Add variables to the context.
The template needs these variables to render the correct page. (E.g. whether to render the registration or cancellation button.)
- Returns:
The context data for the template as a dictionary wrapping
context.registration_active (bool) – Whether the user has an active registration for this event.
context.queue_position (int | None) – The position in the queue of the user, if applicable.
context.num_registrations (int) – The number of active registrations for this event.
context.fine_amount_display (str) – The fine amount as a string with two decimals and a comma as decimal separator.
- post(request, *_args, **_kwargs)
Handle the post request for the event view.
- create_registration(user)
Create a registration for the current user and event.
- cancel_registration(request)
Cancel the registration for the current user and event.
- get_registration_for_current_user()
Get active registrations for logged in user.
- get_registration_button_text(registration: EventRegistration | None) str
Determine the text for the registration button for user and event status.
- Parameters:
registration (EventRegistration | None)
- Return type:
- class loefsys.events.views.RegistrationFormView(**kwargs)
Bases:
LoginRequiredMixin,FormViewView for the registration form.
- template_name = 'events/registration_form.html'
- form_class
alias of
EventFieldsForm
- event = None
- success_url = None
- get_form_kwargs()
Get form keyword arguments.
- form_valid(form)
Handle valid form.
- dispatch(request, *args, **kwargs)
Return the proper response to a request.
- class loefsys.events.views.CalendarView(**kwargs)
Bases:
LoginRequiredMixin,TemplateViewView for displaying the event calendar.
- template_name = 'events/calendar.html'
- class loefsys.events.views.EventFillerView(**kwargs)
Bases:
ViewView for the event filler.
- get(request)
Get the events for the calendar.
- class loefsys.events.views.EventFeedView(**kwargs)
Bases:
TemplateView,LoginRequiredMixinView for the event feed.
- template_name = 'events/event_feed.html'
- get_context_data(**kwargs)
Get the event feed.