From 25851dc8a34a5a5ff55a604fb897bebf95a3944b Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Sat, 18 Mar 2023 15:48:07 +0100 Subject: [PATCH] add backrefs to models --- truthinquiry/ext/database/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/truthinquiry/ext/database/models.py b/truthinquiry/ext/database/models.py index c53a8e7..5c16f5d 100644 --- a/truthinquiry/ext/database/models.py +++ b/truthinquiry/ext/database/models.py @@ -15,7 +15,7 @@ class Text(Base): LID = Column(Integer, ForeignKey("T_LOCALE.LID"), comment="Reference to the locale that this text provides") LANG = Column(VARCHAR(2), comment="lang ID of the text value in this row, e.g FR, EN, ES") TEXT = Column(Text, comment="Actual text stored") - LOCALE = relationship("Locale") + LOCALE = relationship("Locale", backref='TEXTS') def __init__(self, TEXT_ID, LID, LANG, TEXT): self.TEXT_ID = TEXT_ID @@ -104,7 +104,7 @@ class Answer(Base): NPC_ID = Column(Integer, ForeignKey("T_NPC.NPC_ID"), primary_key=True, comment="ID of the NPC that will say this answer") TEXT_LID = Column(Integer, ForeignKey("T_LOCALE.LID"), comment="Text of the answer") LOCALE = relationship("Locale") - NPC = relationship("Npc") + NPC = relationship("Npc", backref="ANSWERS") def __init__(self, QUESTION_TYPE_ID, NPC_ID, TEXT_LID): self.QUESTION_TYPE_ID = QUESTION_TYPE_ID