diff --git a/backend/trip/models/models.py b/backend/trip/models/models.py index 396d1e5..4892b80 100644 --- a/backend/trip/models/models.py +++ b/backend/trip/models/models.py @@ -259,7 +259,7 @@ class Trip(TripBase, table=True): image: Image | None = Relationship(back_populates="trips") user: str = Field(foreign_key="user.username", ondelete="CASCADE") - places: list["Place"] = Relationship(back_populates="trips", link_model=TripPlaceLink) + places: list["Place"] = Relationship(back_populates="trips", sa_relationship_kwargs={"order_by": "Place.name"}, link_model=TripPlaceLink) days: list["TripDay"] = Relationship(back_populates="trip", sa_relationship_kwargs={"order_by": "TripDay.label"}, cascade_delete=True) shares: list["TripShare"] = Relationship(back_populates="trip", cascade_delete=True) packing_items: list["TripPackingListItem"] = Relationship(back_populates="trip", cascade_delete=True)