events package

Submodules

events.admin module

Registers admin interfaces for the events module

class events.admin.EventAdmin(model, admin_site)[source]

Bases: utils.admin.DoNextTranslatedModelAdmin

Manage the events

actions = ('make_published', 'make_unpublished')
date_hierarchy = 'start'
event_date(obj)[source]
exclude = None
fields = None
fieldsets = (('General', {'fields': ('title_en', 'title_nl', 'published', 'organiser')}), ('Detail', {'fields': ('category', 'start', 'end', 'description_en', 'description_nl', 'location_en', 'location_nl', 'map_location'), 'classes': ('collapse', 'start-open')}), ('Registrations', {'fields': ('price', 'fine', 'max_participants', 'registration_start', 'registration_end', 'cancel_deadline', 'send_cancel_email', 'no_registration_message_en', 'no_registration_message_nl'), 'classes': ('collapse',)}), ('Extra', {'fields': ('slide', 'documents'), 'classes': ('collapse',)}))
filter_horizontal = ('documents',)
formfield_for_dbfield(db_field, request, **kwargs)[source]

Customise formfield for organiser

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Customise the organiser formfield, limit the options

get_actions(request)[source]

Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.

get_formsets_with_inlines(request, obj=None)[source]

Yield formsets and the corresponding inlines.

get_urls()[source]
has_change_permission(request, event=None)[source]

Only allow access to the change form if the user is an organiser

inlines = (<class 'events.admin.RegistrationInformationFieldInline'>, <class 'events.admin.PizzaEventInline'>)
list_display = ('overview_link', 'event_date', 'registration_date', 'num_participants', 'organiser', 'category', 'published', 'edit_link')
list_filter = (<class 'events.admin.LectureYearFilter'>, 'start', 'published', 'category')
make_published(request, queryset)[source]

Action to change the status of the event

make_unpublished(request, queryset)[source]

Action to change the status of the event

property media
num_participants(obj)[source]

Pretty-print the number of participants

prepopulated_fields = {'map_location': ('location_en',)}
registration_date(obj)[source]
save_formset(request, form, formset, change)[source]

Save formsets with their order

search_fields = ('title_en', 'title_nl', 'description_en', 'description_nl')
class events.admin.LectureYearFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.filters.SimpleListFilter

Filter the events on those started or ended in a lecture year

lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

parameter_name = 'lecture_year'
queryset(request, queryset)[source]

Return the filtered queryset.

title = 'lecture year'
class events.admin.PizzaEventInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.StackedInline

The inline for pizza events in the Event admin

exclude = ('end_reminder',)
extra = 0
max_num = 1
property media
model

alias of pizzas.models.PizzaEvent

class events.admin.RegistrationAdmin(model, admin_site)[source]

Bases: utils.admin.DoNextTranslatedModelAdmin

Custom admin for registrations

exclude = None
fields = None
form

alias of events.forms.RegistrationAdminForm

formfield_for_dbfield(db_field, request, **kwargs)[source]

Customise the formfields of event and member

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Customise the formfields of event and member

get_urls()[source]
has_change_permission(request, registration=None)[source]

Only give change permission if the user is an organiser

has_delete_permission(request, registration=None)[source]

Only give delete permission if the user is an organiser

has_view_permission(request, registration=None)[source]

Only give view permission if the user is an organiser

property media
save_model(request, registration, form, change)[source]

Given a model instance save it to the database.

search_fields = ()
class events.admin.RegistrationInformationFieldInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

The inline for registration information fields in the Event admin

extra = 0
form

alias of events.forms.RegistrationInformationFieldForm

get_formset(request, obj=None, **kwargs)[source]

Return a BaseInlineFormSet class for use in admin add/change views.

property media
model

alias of events.models.registration_information_field.RegistrationInformationField

ordering = ('_order',)
radio_fields = {'type': 2}

events.admin_views module

class events.admin_views.EventAdminDetails(**kwargs)[source]

Bases: django.views.generic.detail.DetailView, django.contrib.auth.mixins.PermissionRequiredMixin

Renders an overview of registrations for the specified event

context_object_name = 'event'
dispatch(request, *args, **kwargs)
get_context_data(**kwargs)[source]

Insert the single object into the context dict.

model

alias of events.models.event.Event

permission_required = 'events.change_event'
template_name = 'events/admin/details.html'
class events.admin_views.EventMessage(**kwargs)[source]

Bases: django.views.generic.edit.FormView

Renders a form that allows the user to create a push notification for all users registers to the event.

admin = None
dispatch(request, *args, **kwargs)[source]
form_class

alias of events.forms.EventMessageForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

template_name = 'events/admin/message_form.html'
class events.admin_views.EventRegistrationEmailsExport(**kwargs)[source]

Bases: django.views.generic.base.TemplateView, django.contrib.auth.mixins.PermissionRequiredMixin

Renders a page that outputs all email addresses of registered members for an event

dispatch(request, *args, **kwargs)
get_context_data(**kwargs)[source]
permission_required = 'events.view_event'
template_name = 'events/admin/email_export.html'
class events.admin_views.EventRegistrationsExport(**kwargs)[source]

Bases: django.views.generic.base.View, django.contrib.auth.mixins.PermissionRequiredMixin

View to export registrations

dispatch(request, *args, **kwargs)
get(request, pk)[source]

Export the registration of a specified event

Parameters
  • request – the request object

  • pk – the primary key of the event

Returns

A CSV containing all registrations for the event

permission_required = 'events.change_event'
template_name = 'events/admin/details.html'
class events.admin_views.RegistrationAdminFields(**kwargs)[source]

Bases: django.views.generic.edit.FormView

Renders a form that allows the user to change the details of their registration. The user should be authenticated.

admin = None
dispatch(request, *args, **kwargs)[source]
form_class

alias of events.forms.FieldsForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

registration = None
template_name = 'admin/change_form.html'

events.apps module

Configuration for the events package

class events.apps.EventsConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

AppConfig for the events package

name = 'events'
verbose_name = 'Events'

events.decorators module

The decorators defined by the events package

class events.decorators.OrganiserOnly(view_function)[source]

Bases: object

Decorator that denies access to the page if: 1. There is no pk or registration in the request 2. The specified event does not exist 3. The user is no organiser of the specified event

events.decorators.organiser_only(view_function)[source]

See OrganiserOnly

events.emails module

The emails defined by the events package

events.emails.notify_first_waiting(event)[source]

Send an email to the first person on the waiting list when someone cancels their registration

Parameters

event – the event

events.emails.notify_organiser(event, registration)[source]

Send an email to the organiser of the event if someone cancels their registration

Parameters
  • event – the event

  • registration – the registration that was cancelled

events.exceptions module

exception events.exceptions.RegistrationError[source]

Bases: Exception

Custom error for problems during registration

events.feeds module

The feeds defined by the events package

class events.feeds.EventFeed(lang='en')[source]

Bases: django_ical.views.ICalFeed

Output an iCal feed containing all published events

file_name()[source]
item_description(item)[source]
item_end_datetime(item)[source]
item_location(item)[source]
item_start_datetime(item)[source]
item_title(item)[source]
items()[source]
product_id()[source]
title()[source]

events.forms module

class events.forms.EventMessageForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

Form that outputs a widget to get info to send a push notification

base_fields = {'body_en': <django.forms.fields.CharField object>, 'body_nl': <django.forms.fields.CharField object>, 'title_en': <django.forms.fields.CharField object>, 'title_nl': <django.forms.fields.CharField object>, 'url': <django.forms.fields.CharField object>}
declared_fields = {'body_en': <django.forms.fields.CharField object>, 'body_nl': <django.forms.fields.CharField object>, 'title_en': <django.forms.fields.CharField object>, 'title_nl': <django.forms.fields.CharField object>, 'url': <django.forms.fields.CharField object>}
property media

Return all media required to render the widgets on this form.

class events.forms.FieldsForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

Form that outputs the correct widgets for the information fields

base_fields = {}
declared_fields = {}
field_values()[source]
property media

Return all media required to render the widgets on this form.

class events.forms.RegistrationAdminForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

Custom admin form to add a link to the registration information fields admin

class Meta[source]

Bases: object

fields = '__all__'
model

alias of events.models.event_registration.EventRegistration

base_fields = {'date': <django.forms.fields.DateTimeField object>, 'date_cancelled': <django.forms.fields.DateTimeField object>, 'event': <django.forms.models.ModelChoiceField object>, 'fields': <django.forms.fields.URLField object>, 'member': <django.forms.models.ModelChoiceField object>, 'name': <django.forms.fields.CharField object>, 'payment': <django.forms.models.ModelChoiceField object>, 'present': <django.forms.fields.BooleanField object>}
declared_fields = {'fields': <django.forms.fields.URLField object>}
property media

Return all media required to render the widgets on this form.

class events.forms.RegistrationInformationFieldForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

Custom form for the registration information fields that adds an order field

class Meta[source]

Bases: object

fields = '__all__'
model

alias of events.models.registration_information_field.RegistrationInformationField

widgets = {'type': <class 'django.forms.widgets.Select'>}
base_fields = {'description_en': <django.forms.fields.CharField object>, 'description_nl': <django.forms.fields.CharField object>, 'event': <django.forms.models.ModelChoiceField object>, 'name_en': <django.forms.fields.CharField object>, 'name_nl': <django.forms.fields.CharField object>, 'order': <django.forms.fields.IntegerField object>, 'required': <django.forms.fields.BooleanField object>, 'type': <django.forms.fields.TypedChoiceField object>}
declared_fields = {'order': <django.forms.fields.IntegerField object>}
property media

Return all media required to render the widgets on this form.

events.services module

events.services.cancel_registration(member, event)[source]

Cancel a user registration for an event

Parameters
  • member – the user

  • event – the event

events.services.create_registration(member, event)[source]

Creates a new user registration for an event

Parameters
  • member – the user

  • event – the event

Returns

returns the registration if successful

events.services.event_permissions(member, event, name=None)[source]

Returns a dictionary with the available event permissions of the user

Parameters
  • member – the user

  • event – the event

  • name – the name of a non member registration

Returns

the permission dictionary

events.services.generate_category_statistics()[source]

Generate statistics about events, number of events per category :return: Dict with key, value resp. being category, event count.

events.services.is_organiser(member, event)[source]
events.services.is_user_registered(member, event)[source]

Returns if the user is registered for the specified event

Parameters
  • member – the user

  • event – the event

Returns

None if registration is not required or no member else True/False

events.services.pay_with_tpay(member, event)[source]

Add a Thalia Pay payment to an event registration

Parameters
  • member – the user

  • event – the event

events.services.registration_fields(request, member=None, event=None, registration=None, name=None)[source]

Returns information about the registration fields of a registration

Parameters
  • member – the user (optional if registration provided)

  • name – the name of a non member registration (optional if registration provided)

  • event – the event (optional if registration provided)

  • registration – the registration (optional if member & event provided)

Returns

the fields

events.services.update_registration(member=None, event=None, name=None, registration=None, field_values=None)[source]

Updates a user registration of an event

Parameters
  • request – http request

  • member – the user

  • event – the event

  • name – the name of a registration not associated with a user

  • registration – the registration

  • field_values – values for the information fields

events.services.update_registration_by_organiser(registration, member, data)[source]

events.sitemaps module

The sitemaps defined by the events package

class events.sitemaps.EventSitemap[source]

Bases: django.contrib.sitemaps.Sitemap

Sitemap of the event detail pages

items()[source]
location(item)[source]
class events.sitemaps.StaticViewSitemap[source]

Bases: django.contrib.sitemaps.Sitemap

Sitemap of the static event pages

changefreq = 'daily'
items()[source]
location(item)[source]

events.urls module

Routes defined by the events package

events.views module

Views provided by the events package

class events.views.AlumniEventsView(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

Renders the alumni events page

get_context_data(**kwargs)[source]
template_name = 'events/alumni.html'
class events.views.EventCancelView(**kwargs)[source]

Bases: django.views.generic.base.View

Defines a view that allows the user to cancel their event registration using a POSt request. The user should be authenticated.

dispatch(request, *args, **kwargs)
get(request, *args, **kwargs)[source]
post(request, *args, **kwargs)[source]
class events.views.EventDetail(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

Renders a single event detail page

context_object_name = 'event'
get_context_data(**kwargs)[source]

Insert the single object into the context dict.

model

alias of events.models.event.Event

queryset
template_name = 'events/event.html'
class events.views.EventIndex(**kwargs)[source]

Bases: django.views.generic.base.TemplateView

Renders the events calendar overview

get_context_data(**kwargs)[source]
template_name = 'events/index.html'
class events.views.EventPayView(**kwargs)[source]

Bases: django.views.generic.base.View

Defines a view that allows the user to add a Thalia Pay payment to their event registration using a POST request. The user should be authenticated.

dispatch(request, *args, **kwargs)
get(request, *args, **kwargs)[source]
post(request, *args, **kwargs)[source]
class events.views.EventRegisterView(**kwargs)[source]

Bases: django.views.generic.base.View

Defines a view that allows the user to register for an event using a POST request. The user should be authenticated.

dispatch(request, *args, **kwargs)
get(request, *args, **kwargs)[source]
post(request, *args, **kwargs)[source]
class events.views.RegistrationView(**kwargs)[source]

Bases: django.views.generic.edit.FormView

Renders a form that allows the user to change the details of their registration. The user should be authenticated.

dispatch(request, *args, **kwargs)[source]
event = None
form_class

alias of events.forms.FieldsForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

template_name = 'events/registration.html'

events.widgets module

Widgets provided by the payments package

class events.widgets.FieldsWidget(attrs=None)[source]

Bases: django.forms.widgets.Widget

Custom widget for linking to the fields, used in registrations

property media
template_name = 'events/admin/fields_widget.html'
value_from_datadict(data, files, name)[source]

Given a dictionary of data and this widget’s name, return the value of this widget or None if it’s not provided.