Skip to content

Commit

Permalink
Add code value additional information test; fix test assertion report…
Browse files Browse the repository at this point in the history
…ing (#437)
  • Loading branch information
Rikuoja authored Feb 6, 2025
1 parent f6ad036 commit 03f63f2
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 14 deletions.
2 changes: 1 addition & 1 deletion database/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def type_of_underground(cls) -> Mapped[VersionedBase]: # noqa
# class reference in abstract base class, with backreference to class name:
@declared_attr
def plan(cls) -> Mapped[VersionedBase]: # noqa
return relationship("Plan", backref=f"{cls.__tablename__}s")
return relationship("Plan", back_populates=f"{cls.__tablename__}s")

# class reference in abstract base class, with backreference to class name:
@declared_attr
Expand Down
14 changes: 14 additions & 0 deletions database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ class Plan(PlanBase):
documents = relationship(
"Document", back_populates="plan", lazy="joined", cascade="delete"
)
# Load plan objects ordered
land_use_areas = relationship(
"LandUseArea", order_by="LandUseArea.ordering", back_populates="plan"
)
other_areas = relationship(
"OtherArea", order_by="OtherArea.ordering", back_populates="plan"
)
lines = relationship("Line", order_by="Line.ordering", back_populates="plan")
land_use_points = relationship(
"LandUsePoint", order_by="LandUsePoint.ordering", back_populates="plan"
)
other_points = relationship(
"OtherPoint", order_by="OtherPoint.ordering", back_populates="plan"
)

permanent_plan_identifier: Mapped[Optional[str]]
producers_plan_identifier: Mapped[Optional[str]]
Expand Down
Loading

0 comments on commit 03f63f2

Please sign in to comment.