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

event_picture_upload_path(_)

Return the upload path for the event picture.

picture

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

start

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.

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_deadline

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

cancelation_deadline

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.

capacity

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

price

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

fine

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.

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.

published

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

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.

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

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.

objects = <loefsys.events.models.managers.EventManager object>
property url: str

Url for the event.

get_absolute_url()

Return the detail page url for this registration.

mandatory_registration() bool

Check whether this event has mandatory registration.

Returns:

A boolean that defines whether registration is mandatory.

Return type:

bool

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

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

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

process_cancellation() None

Process the side effects for an event of a cancellation.

Return type:

None

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

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.

description

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

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.

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()
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.

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.

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.

title

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

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

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.

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.

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.

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_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)
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>
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

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.

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.

status

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

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.

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.

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.

property form_fields

Get form fields and their values on the registration form.

objects = <loefsys.events.models.managers.EventRegistrationManager object>
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)

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

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

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.

contact_id
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_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)
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.

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.

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.

token

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

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.

static get_user(token)
exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

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>
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'
INTEGER_FIELD = 'integer'
TEXT_FIELD = 'text'
DATETIME_FIELD = 'datetime'
FIELD_TYPES = [('boolean', 'Boolean'), ('integer', 'Geheel getal'), ('text', 'Tekst'), ('datetime', 'Datetime')]
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.

type

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

subject

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.

required

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

property default

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

get_value_for(registration)

Get value for registration form field based on registration.

set_value_for(registration, value)

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

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.

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_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>)
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>
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.

Submodules