From 844a05202e81e8aeaa25d2f0af91b984f361042e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 4 Aug 2017 16:07:35 -0500 Subject: [PATCH] Add `Client.readings` backref --- rattail_tempmon/db/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rattail_tempmon/db/model.py b/rattail_tempmon/db/model.py index ba7e63a..b3e1ece 100644 --- a/rattail_tempmon/db/model.py +++ b/rattail_tempmon/db/model.py @@ -135,7 +135,10 @@ class Reading(Base): Client, doc=""" Reference to the tempmon client which took this reading. - """) + """, + backref=orm.backref( + 'readings', + cascade='all, delete-orphan')) probe_uuid = sa.Column(sa.String(length=32), nullable=False) probe = orm.relationship(