Source code for reservation.models.custom_allocation

from libres.db.models import Allocation
from onegov.core.orm import ModelBase
from onegov.reservation.models.resource import Resource
from sqlalchemy.orm import object_session


[docs] class CustomAllocation(Allocation, ModelBase):
[docs] __mapper_args__ = {'polymorphic_identity': 'custom'} # type:ignore
@property
[docs] def resource_obj(self) -> Resource: return object_session(self).query( Resource).filter_by(id=self.resource).one()
@property
[docs] def access(self) -> str: return (self.data or {}).get('access', 'public')