loefsys.reservations.models package

Module defining models for the reservations app.

class loefsys.reservations.models.Boat(*args, **kwargs)

Bases: ReservableItem

Describes a boat that can be reserved.

A boat is part of our or any external fleet of boats. It can be any type of boat. A boat requires a certain skipper’s certificate. It has a limited capacity and can possibly have an engine.

capacity

The capacity of the boat.

Type:

int

has_engine

Flag that determines whether the boat has an engine.

Type:

bool

fleet

The provider of the boat.

Type:

FleetChoices

requires_skippership

The skippership needed to reserve the boat. Can be none.

Type:

Skippership

capacity

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

has_engine

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

fleet

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

requires_skippership

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.

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

get_fleet_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: fleet>)
requires_skippership_id
reservableitem_ptr

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.

reservableitem_ptr_id
class loefsys.reservations.models.Material(*args, **kwargs)

Bases: ReservableItem

Describes a material item that can be reserved.

A gear-piece is any wearable item used for sailing. It is of a type and has a size measure.

size

The size of the item (if applicable?).

Type:

str

size

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

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

reservableitem_ptr

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.

reservableitem_ptr_id
class loefsys.reservations.models.ReservableItem(*args, **kwargs)

Bases: Model Extensions

The base model for a reservable item.

A reservable item is an object that can be reserved. It can be set as non-reservable, for example due to maintenance. Additionally, it has a location and has a list of known complications.

TODO Add complications.

name

The name of the item.

Type:

str

description

A description of the item.

Type:

str

reservable_type

The type for which the pricing is set.

Type:

ReservableType

location

The location of the item.

Type:

Locations

is_reservable

Flag to show availability.

For example, if an item is unavailable due to maintenance, the value is set to False.

Type:

bool

name

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.

reservable_type

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.

location

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

is_reservable

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

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

boat

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.

created

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

get_location_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: location>)
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.

material

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.

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>
reservable_type_id
reservation_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.

room

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.

class loefsys.reservations.models.ReservableType(*args, **kwargs)

Bases: Model Extensions

Model representing a type of reservable.

This model exists to be able to make a collection of all reservables of the same type. Examples are wetsuits of the same size or the two ‘valkjes’ Scylla and Charybdis.

name

The name of the type.

Type:

str

category

The category that the type falls under.

Type:

ReservableCategories

description

An additional description of the type.

Type:

str

name

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.

description

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

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.

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

log_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 = <django.db.models.manager.Manager object>
reservableitem_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.

reservabletypepricing

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.

class loefsys.reservations.models.ReservableTypePricing(*args, **kwargs)

Bases: Model Extensions

Pricing for the type of reservable.

With this model, the pricing for a given ReservableType can be set for any membership defined by the Memberships enum.

reservable_type

The type for which the pricing is set.

Type:

ReservableType

membership_type

The membership type for which the pricing is set.

Type:

MembershipTypes

price

The price in euro’s.

Type:

Decimal

reservable_type

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.

membership_type

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.

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.

get_membership_type_display(*, field=<django.db.models.fields.PositiveSmallIntegerField: membership_type>)
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>
reservable_type_id
class loefsys.reservations.models.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:

ReservableItem

reservee_member

The person reserving the item, is null if a group is reserving the item.

Type:

MemberDetails

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

start

The start timestamp of the reservation.

Type:

datetime

end

The end timestamp of the reservation.

Type:

datetime

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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor 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
class loefsys.reservations.models.Room(*args, **kwargs)

Bases: ReservableItem

Model defining a room that can be reserved.

A room is a place the Loefbijter owns which can be used by any part within Loefbijter (this does not include the VvS). It has a limited capacity and has required permission.

capacity

The capacity of the room.

Type:

int

capacity

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

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

reservableitem_ptr

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.

reservableitem_ptr_id

Submodules