From 9ae0e6c009ccdb2384757db771042a866bf8d13c Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Jun 05 2025 11:38:21 +0000 Subject: Fix SQLAlchemy warning Since Calendar and Meeting class reference each others, we have to be explicit on the way the library must deal with conflicts. In this case, the solution is to update the other object when there is a change. It should partially fix #223 --- diff --git a/fedocal/fedocallib/model.py b/fedocal/fedocallib/model.py index 0ef9d7c..940fcf5 100644 --- a/fedocal/fedocallib/model.py +++ b/fedocal/fedocallib/model.py @@ -141,7 +141,7 @@ class Calendar(BASE): ForeignKey('calendar_status.status', onupdate="cascade"), default='Enabled', nullable=False) - meetings = relationship("Meeting") + meetings = relationship("Meeting", back_populates="calendar") def __init__( self, calendar_name, calendar_contact, calendar_description, @@ -336,7 +336,7 @@ class Meeting(BASE): String(80), ForeignKey('calendars.calendar_name', onupdate="cascade"), nullable=False) - calendar = relationship("Calendar", lazy='joined') + calendar = relationship("Calendar", lazy='joined', back_populates="meetings") # 5 person max (32 * 5) + 5 = 165 meeting_manager_user = relationship('MeetingsUsers', lazy='joined') meeting_date = Column(Date, default=safunc.now(), nullable=False)