From 7f4087e046a0d087ab1df6014c211a365c8043a7 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 27 Mar 2020 18:06:31 +0100 Subject: [PATCH] Add a "transactions" backref to User --- database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.py b/database.py index 5b87b18..ee51c8b 100644 --- a/database.py +++ b/database.py @@ -149,7 +149,7 @@ class Transaction(TableDeclarativeBase): transaction_id = Column(Integer, primary_key=True) # The user whose credit is affected by this transaction user_id = Column(BigInteger, ForeignKey("users.user_id"), nullable=False) - user = relationship("User") + user = relationship("User", backref=backref("transactions")) # The value of this transaction. Can be both negative and positive. value = Column(Integer, nullable=False) # Refunded status: if True, ignore the value of this transaction when recalculating