loefsys.events.models package

Module containing the models related to events.

class loefsys.events.models.Event(*args, **kwargs)

Bases: Model Extensions, Model Extensions

Model for an event.

An event is an activity that people can sign up for. This can be a sail training, a cantus, or any other activity that is organized for the association. Events have many properties, such as a start and end date, a category, a price, a location, and more.

created

The timestamp of the creation of the model, automatically generated upon creation.

Type:

datetime

modified

The timestamp of last modification of this model, automatically generated upon update.

Type:

datetime

title

The title to display for the event.

Type:

str

description

An optional description of the event.

Type:

str, None

picture

The picture for an event.

Type:

ImageFieldFile

slug

A slug for the URL of the event, automatically generated from the title.

Type:

str

start

The start date and time of the event.

Type:

datetime

end

The end date and time of the event.

Type:

datetime

registration_start

The start date and time of the registration window

Type:

datetime

registration_deadline

The end date and time of the registration window

Type:

datetime

cancelation_deadline

The end date and time of the cancelation window

Type:

datetime

category

The category of the event.

Type:

EventCategories

capacity

The maximum number of participants if there is one

Type:

Integer

price

The price.

Type:

Decimal

fine

The fine if a participant does not show up.

Type:

Decimal

location

The location of the event.

We might want to include a Google Maps widget showing the location. django-google-maps might be useful for this.

Type:

str

is_open_event

Flag to determine if non-members can register.

Type:

bool

published

Flag to determine if the event is publicly visible.

Type:

bool

send_cancel_email

Flag to determine if an email should be sent if a participant deregisters

Type:

~bool

eventregistration_set

A manager of registrations for this event.

It is the one-to-many relationship to EventRegistration.

Type:

EventRegistrationManager

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

cancelation_consequences() str

Determine whether canceling a registration has consequences.

Returns:

True when canceling has consequences, otherwise False.

Return type:

bool

cancelation_deadline

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cancelation_window_open() bool

Determine whether it is possible for users to cancel their registration.

For events with required registration, cancellation is only possible when the event is published and in the cancellation window defined by start and cancelation_deadline.

Returns:

A boolean that defines whether cancellations are in the cancellation window.

Return type:

bool

capacity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

category

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

event_picture_upload_path(_)

Return the upload path for the event picture.

eventorganizer

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

eventregistration_set: EventRegistrationManager

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

fine

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fine_on_cancellation() bool

Check whether the cancellation of a registration will result in a fine.

Returns:

True when a fine will be applied and False when cancellation is free of charge.

Return type:

bool

get_absolute_url()

Return the detail page url for this registration.

get_category_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: category>)
get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)
get_next_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=True, **kwargs)
get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)
get_next_by_start(*, field=<django.db.models.fields.DateTimeField: start>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)
get_previous_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=False, **kwargs)
get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)
get_previous_by_start(*, field=<django.db.models.fields.DateTimeField: start>, is_next=False, **kwargs)
get_registrationformfield_order()
property has_form_fields: bool

Check if the event has associated form fields.

Returns:

True if the event has form fields, otherwise False.

Return type:

bool

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_open_event

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

location

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

mandatory_registration() bool

Check whether this event has mandatory registration.

Returns:

A boolean that defines whether registration is mandatory.

Return type:

bool

max_capacity_reached() bool

Check whether the max capacity for this event is reached.

Returns:

True when the event is full and False if there are places available.

Return type:

bool

modified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <loefsys.events.models.managers.EventManager object>
picture

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

price

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

process_cancellation() None

Process the side effects for an event of a cancellation.

Return type:

None

published

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

registration_deadline

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

registration_start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

registration_window_open() bool

Determine whether it is possible for users to register for this event.

For events with required registration, registration is only possible when the event is published and in the registration window defined by start and end.

Returns:

A boolean that defines whether registrations are in the registration window.

Return type:

bool

registrationformfield_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

registrations_open() bool

Determine whether it is possible for users to register for this event.

Returns:

A boolean that defines whether registrations are open.

Return type:

bool

send_cancel_email

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

set_registrationformfield_order(id_list, using=None)
slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property url: str

Url for the event.

class loefsys.events.models.EventOrganizer(*args, **kwargs)

Bases: Model Extensions

Utility model collecting the organizers for an event.

created

The timestamp of the creation of the model, automatically generated upon creation.

Type:

datetime

modified

The timestamp of last modification of this model, automatically generated upon update.

Type:

datetime

event

The event that the current organizer organizes.

Type:

Event

groups

The groups organizing this event.

Type:

QuerySet of LoefbijterGroup

user

Individuals organizing this event.

Type:

QuerySet of User

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

created

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

event

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

event_id
get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)
get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)
get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)
groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
user

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class loefsys.events.models.EventRegistration(*args, **kwargs)

Bases: Model Extensions

Registration model for an event.

Registering for an event lets you claim a spot in the event. If an event is full, the registration is put in a queue. The registration can be also be cancelled, with a possible fine if it is cancelled late. Registrations can also come with a price.

created

The timestamp of the creation of this model.

Type:

datetime

modified

The timestamp of last modification of this model.

Type:

datetime

event

The event to which the registration applies.

Type:

Event

contact

The contact that the registration is for.

Type:

Contact

status

The status is active, in the queue, or cancelled, either with or without fine.

Type:

RegistrationStatus

price_at_registration

The agreed price of the event at the time of registration.

Type:

Decimal

fine_at_registration

The agreed fine for cancellation at the time of registration.

Type:

Decimal

costs

The cost for this event, automatically calculated from the status.

Type:

Decimal

costs_paid

The amount paid for this registration by the contact.

Type:

Decimal

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

booleanregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

cancel() None

Cancel a registration.

Upon cancellation, it is calculated whether a fine will be applied. The status of the registration is then either changed to loefsys.events.models.choices.RegistrationStatus.CANCELLED_FINE or loefsys.events.models.choices.RegistrationStatus.CANCELLED_NOFINE. Afterwards, the event is notified to potentially activate a registration in the queue.

Return type:

None

contact

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

contact_id
costs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

costs_paid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

costs_to_pay() Decimal

Calculate the amount needed to be paid by the registration contact.

TODO See if this function can be converted into a GeneratedField as well.

Returns:

The amount of money in Euro’s.

Return type:

Decimal

created

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

datetimeregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

event

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

event_id
fine_at_registration

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property form_fields

Get form fields and their values on the registration form.

get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)
get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)
get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)
property get_queue_position: int | None

Get the position in the queue for this registration.

Returns:

The position in the queue, starting at 1. If not in the queue, returns None.

Return type:

int

get_status_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: status>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

integerregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

modified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <loefsys.events.models.managers.EventRegistrationManager object>
price_at_registration

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(**kwargs: Any) None

Save the model to the database.

When creating a new registration, the attributes price_at_registration and fine_at_registration are copied from the :attr`.event`.

Return type:

None

Parameters:

kwargs (Any)

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

textregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class loefsys.events.models.FeedToken(*args, **kwargs)

Bases: Model

Used to personalize the ical Feed.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

static get_user(token)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
save(**kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

token

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

user_id
class loefsys.events.models.RegistrationFormField(*args, **kwargs)

Bases: Model

Represents a registration form for events.

This model stores the subject, response, and associated event for a registration.

BOOLEAN_FIELD = 'boolean'
DATETIME_FIELD = 'datetime'
exception DoesNotExist

Bases: ObjectDoesNotExist

FIELD_TYPES = [('boolean', 'Boolean'), ('integer', 'Geheel getal'), ('text', 'Tekst'), ('datetime', 'Datetime')]
INTEGER_FIELD = 'integer'
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

TEXT_FIELD = 'text'
booleanregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

datetimeregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property default

Get default value for registration form field based on its type.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

event

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

event_id
get_next_in_order(*, is_next=True)
get_previous_in_order(*, is_next=False)
get_type_display(*, field=<django.db.models.fields.CharField: type>)
get_value_for(registration)

Get value for registration form field based on registration.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

integerregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
required

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

set_value_for(registration, value)

Set value for registration form field based on registration and value.

subject

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

textregistrationinformation_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Submodules