From 262eea2b38a6d826208c2abb8f622f2bb6cef4d1 Mon Sep 17 00:00:00 2001 From: valentino-sm <5059499+valentino-sm@users.noreply.github.com> Date: Thu, 6 May 2021 08:42:22 +0500 Subject: [PATCH] fix orderitem-order relation warning --- database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database.py b/database.py index 6887650..299615e 100644 --- a/database.py +++ b/database.py @@ -241,7 +241,7 @@ class Order(DeferredReflection, TableDeclarativeBase): # Refund reason: if null, product hasn't been refunded refund_reason = Column(Text) # List of items in the order - items: typing.List["OrderItem"] = relationship("OrderItem") + items: typing.List["OrderItem"] = relationship("OrderItem", back_populates="order") # Extra details specified by the purchasing user notes = Column(Text) # Linked transaction @@ -297,7 +297,7 @@ class OrderItem(DeferredReflection, TableDeclarativeBase): product = relationship("Product") # The order in which this item is being purchased order_id = Column(Integer, ForeignKey("orders.order_id"), nullable=False) - order = relationship("Order") + order = relationship("Order", back_populates="items") # Extra table parameters __tablename__ = "orderitems"