reservation.models.resource

Attributes

DeadlineUnit

Classes

Resource

A resource holds a single calendar with allocations and reservations.

Functions

extra_scheduler_arguments(→ dict[str, Any])

Module Contents

reservation.models.resource.DeadlineUnit: TypeAlias = Literal['d', 'h'][source]
reservation.models.resource.extra_scheduler_arguments() dict[str, Any][source]
class reservation.models.resource.Resource[source]

Bases: libres.db.models.base.ORMBase, onegov.core.orm.ModelBase, onegov.core.orm.mixins.ContentMixin, onegov.core.orm.mixins.TimestampMixin, onegov.file.MultiAssociatedFiles

A resource holds a single calendar with allocations and reservations.

Note that this resource is not defined on the onegov.core declarative base. Instead it is defined using the libres base. This means we can’t join data outside the libres models.

This should however not be a problem as this onegov module is self contained and does not link to other onegov modules, except for core.

If we ever want to link to other models (say link a reservation to a user), then we have to switch to a unified base. Ideally we would find a way to merge these bases somehow.

Also note that we do use the ModelBase class as a mixin to at least share the same methods as all the usual onegov.core.orm models.

__tablename__ = 'resources'[source]
id: Column[uuid.UUID][source]
name: Column[str | None][source]
title: Column[str][source]
timezone: Column[str][source]
definition: Column[str | None][source]
group: Column[str | None][source]
type: Column[str][source]
payment_method: onegov.core.orm.mixins.dict_property[PaymentMethod | None][source]
minimum_price_total: onegov.core.orm.mixins.dict_property[float | None][source]
currency: onegov.core.orm.mixins.dict_property[str | None][source]
pricing_method: onegov.core.orm.mixins.dict_property[str | None][source]
price_per_hour: onegov.core.orm.mixins.dict_property[float | None][source]
price_per_item: onegov.core.orm.mixins.dict_property[float | None][source]
deadline: onegov.core.orm.mixins.dict_property[tuple[int, DeadlineUnit] | None][source]
default_view: onegov.core.orm.mixins.dict_property[str | None][source]
zipcode_block: onegov.core.orm.mixins.dict_property[dict[str, Any] | None][source]
access_token: onegov.core.orm.mixins.dict_property[str | None][source]
pick_up: onegov.core.orm.mixins.dict_property[str | None][source]
__mapper_args__[source]
allocations: relationship[list[Allocation]][source]
date: datetime.date | None = None[source]
highlights_min: int | None = None[source]
highlights_max: int | None = None[source]
view: str | None = 'month'[source]
highlight_allocations(allocations: Sequence[Allocation]) None[source]

The allocation to jump to in the view.

get_scheduler(libres_context: libres.context.core.Context) _OurScheduler[source]
property scheduler: _OurScheduler[source]
bind_to_libres_context(libres_context: libres.context.core.Context) None[source]
property form_class: type_t[Form] | None[source]

Parses the form definition and returns a form class.

price_of_reservation(token: uuid.UUID, extra: onegov.pay.Price | None = None) onegov.pay.Price[source]
process_payment(price: onegov.pay.Price | None, provider: PaymentProvider[Any] | None = None, payment_token: str | None = None) Payment | PaymentError | Literal[True] | None[source]

Processes the payment for the given reservation token.

is_past_deadline(dt: datetime.datetime) bool[source]
is_zip_blocked(date: datetime.date) bool[source]
is_allowed_zip_code(zipcode: int) bool[source]
renew_access_token() None[source]
__repr__() str[source]