From 0791a23d8c6a632f394547d48e635f5ca9718b44 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Wed, 22 May 2024 09:53:57 +0200 Subject: [PATCH] fix warning about relationship confilicts Conflict between Consumable.vehicles and Vehicle.consumables resolved by making the Consumable.vehicles a read only relationship since we add consumables only to vehicles. Consumable.vehicles is used in the admin view to check if a consumable can be deleted safely. --- app/entities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/entities.py b/app/entities.py index 19c0deb..b8a447e 100644 --- a/app/entities.py +++ b/app/entities.py @@ -164,7 +164,7 @@ class Consumable(db.Model): name = db.Column(db.String(255), unique=True) unit = db.Column(db.String(255)) - vehicles = db.relationship("Vehicle", secondary=vehicles_consumables) + vehicles = db.relationship("Vehicle", secondary=vehicles_consumables, viewonly=True) def __init__(self, name, unit): self.name = name