loefsys.events.models.event module
In this module, the models for events are defined.
- class loefsys.events.models.event.OverwriteStorage(*args, **kwargs)
Bases:
FileSystemStorage
Custom storage class that overwrites files with the same name.
Needed because when a user uploads a new profile picture, the old one would otherwise still be present together with the new one that gets renamed.
- get_available_name(name, max_length=None)
Given the desired name, derive and return a name that is available.
- class loefsys.events.models.event.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:
- modified
The timestamp of last modification of this model, automatically generated upon update.
- Type:
- picture
The picture for an event.
- Type:
ImageFieldFile
- category
The category of the event.
- Type:
- capacity
The maximum number of participants if there is one
- Type:
Integer
- 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:
- 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:
- 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, otherwiseFalse
.- Return type:
- 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 aReverseManyToOneDescriptor
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>
- 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:
- 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:
- max_capacity_reached() bool
Check whether the max capacity for this event is reached.
- Returns:
True
when the event is full andFalse
if there are places available.- Return type:
- fine_on_cancellation() bool
Check whether the cancellation of a registration will result in a fine.
- Returns:
True
when a fine will be applied andFalse
when cancellation is free of charge.- Return type:
- 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
andend
.- Returns:
A boolean that defines whether registrations are in the registration window.
- Return type:
- 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 aReverseOneToOneDescriptor
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 aReverseManyToOneDescriptor
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.event.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:
- modified
The timestamp of last modification of this model, automatically generated upon update.
- Type:
- groups
The groups organizing this event.
- Type:
- 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 aForwardOneToOneDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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
andTopping.pizzas
areManyToManyDescriptor
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>