From 471258c88693898a103e32c94c5fabf63650cbf3 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 22 Nov 2021 15:33:18 +0100 Subject: [PATCH] [events] Default jobs to unlocked state --- flaschengeist/plugins/events/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flaschengeist/plugins/events/models.py b/flaschengeist/plugins/events/models.py index d1dee02..2cbfd6e 100644 --- a/flaschengeist/plugins/events/models.py +++ b/flaschengeist/plugins/events/models.py @@ -65,8 +65,10 @@ class Job(db.Model, ModelSerializeMixin): end: Optional[datetime] = db.Column(UtcDateTime) type: Union[JobType, int] = db.relationship("JobType") comment: Optional[str] = db.Column(db.String(256)) - locked: bool = db.Column(db.Boolean()) - services: list[Service] = db.relationship("Service", back_populates="job_") + locked: bool = db.Column(db.Boolean(), default=False, nullable=False) + services: list[Service] = db.relationship( + "Service", back_populates="job_", cascade="save-update, merge, delete, delete-orphan" + ) required_services: float = db.Column(db.Numeric(precision=4, scale=2, asdecimal=False), nullable=False) event_ = db.relationship("Event", back_populates="jobs")