Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code value additional information test #437

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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