loefsys.reservations.models.reservation module
Module defining the model for a reservation.
- class loefsys.reservations.models.reservation.Reservation(*args, **kwargs)
Bases:
Model
Model describing a reservation of a reservable item.
A reservation is a ‘time-claim’ anyone can put on a reservable item. It has a start time and end time which is after the start time. The start time may be in the past, but only an admin can create reservation that ends in the past. The start time and end time may be on different dates, as long as the start time is earlier than the end time. A reservation has a reference to a person (or possibly to a group). A reservation has a function which can calculate any costs related to that reservation. A reservation has a log, which the user must fill in after the reservation has ended. A reservation can be linked to a group, training or event.
A boat reservation can be linked to a training (or event). If it is not then it must be reserved by a person with the required skipper’s certificate. If the boat has an engine, then the user can set an amount of engine-hours used.
- reserved_item
The ForeignKey.
- Type:
- reservee_member
The person reserving the item, is null if a group is reserving the item.
- Type:
- reservee_group
The group reserving the item, is null if a person is reserving the item.
- Type:
LoefBijterGroup
- authorized_userskippership
The person who is the authorized skipper for a boat.
- Type:
UserSkippership
- reserved_item
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 aForwardManyToOneDescriptor
instance.
- reservee_user
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 aForwardManyToOneDescriptor
instance.
- authorized_userskippership
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 aForwardManyToOneDescriptor
instance.
- 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.
- date_of_creation
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_absolute_url()
Return the detail page url for this reservation.
- clean()
Check whether any of the other reservations overlap and if the boat requires a skippership.
- Raises:
ValidationError – This item has already been reserved during this timeslot.:
ValidationError – This item is not reservable at the moment.:
ValidationError – The boat selected requires an authorized skipper to be set.:
ValidationError – The skipper set is not authorized for this boat.:
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- authorized_userskippership_id
- get_next_by_date_of_creation(*, field=<django.db.models.fields.DateTimeField: date_of_creation>, is_next=True, **kwargs)
- get_next_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=True, **kwargs)
- get_next_by_start(*, field=<django.db.models.fields.DateTimeField: start>, is_next=True, **kwargs)
- get_previous_by_date_of_creation(*, field=<django.db.models.fields.DateTimeField: date_of_creation>, is_next=False, **kwargs)
- get_previous_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=False, **kwargs)
- get_previous_by_start(*, field=<django.db.models.fields.DateTimeField: start>, 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.
- objects = <django.db.models.manager.Manager object>
- reserved_item_id
- reservee_user_id