Skip to content
Snippets Groups Projects
Verified Commit b9c9b05e authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Work around master_waypoint bug.

parent 0a630337
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,7 @@ class Listing(Base): ...@@ -83,7 +83,7 @@ class Listing(Base):
description = Column(String) description = Column(String)
hints = Column(String) hints = Column(String)
master_waypoint = relationship('Waypoint', uselist=False) master_waypoint_code = Column(String)
waypoints = relationship('Waypoint', back_populates='listing') waypoints = relationship('Waypoint', back_populates='listing')
logs = relationship('Log', back_populates='listing') logs = relationship('Log', back_populates='listing')
...@@ -94,6 +94,16 @@ class Listing(Base): ...@@ -94,6 +94,16 @@ class Listing(Base):
owner_account_id = Column(Integer, ForeignKey('geocacher_accounts.id')) owner_account_id = Column(Integer, ForeignKey('geocacher_accounts.id'))
owner_account = relationship('GeocacherAccount', back_populates='listings') owner_account = relationship('GeocacherAccount', back_populates='listings')
# FIXME use proper relationship
@property
def master_waypoint(self):
for wp in self.waypoints:
if wp.code == self.master_waypoint_code:
return wp
@master_waypoint.setter
def master_waypoint(self, wp):
self.master_waypoint_code = wp.code
@property @property
def code(self): def code(self):
return self.master_waypoint.code return self.master_waypoint.code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment