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.
This commit is contained in:
Joachim Lusiardi 2024-05-22 09:53:57 +02:00
parent 80264f1d02
commit 0791a23d8c
1 changed files with 1 additions and 1 deletions

View File

@ -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