From a8937d3f6da7db124940ad423eb46b4a2cbf9daf Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Thu, 22 Jan 2026 14:59:01 +0100 Subject: [PATCH] Rename `Weapon.hero` field to `Weapon.owner` in code example to better reflect meaning --- .../back_populates/tutorial003_py310.py | 4 ++-- .../back_populates/tutorial003_py39.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py b/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py index aa850b3f69..a759c83965 100644 --- a/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py +++ b/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py @@ -5,7 +5,7 @@ class Weapon(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str = Field(index=True) - hero: "Hero" = Relationship(back_populates="weapon") + owner: "Hero" = Relationship(back_populates="weapon") class Power(SQLModel, table=True): @@ -34,7 +34,7 @@ class Hero(SQLModel, table=True): team: Team | None = Relationship(back_populates="heroes") weapon_id: int | None = Field(default=None, foreign_key="weapon.id") - weapon: Weapon | None = Relationship(back_populates="hero") + weapon: Weapon | None = Relationship(back_populates="owner") powers: list[Power] = Relationship(back_populates="hero") diff --git a/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py39.py b/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py39.py index fc0d08df52..3cb510ebaf 100644 --- a/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py39.py +++ b/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py39.py @@ -7,7 +7,7 @@ class Weapon(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str = Field(index=True) - hero: "Hero" = Relationship(back_populates="weapon") + owner: "Hero" = Relationship(back_populates="weapon") class Power(SQLModel, table=True): @@ -36,7 +36,7 @@ class Hero(SQLModel, table=True): team: Optional[Team] = Relationship(back_populates="heroes") weapon_id: Optional[int] = Field(default=None, foreign_key="weapon.id") - weapon: Optional[Weapon] = Relationship(back_populates="hero") + weapon: Optional[Weapon] = Relationship(back_populates="owner") powers: list[Power] = Relationship(back_populates="hero")