From: Yurii Motov Date: Thu, 22 Jan 2026 13:59:01 +0000 (+0100) Subject: Rename `Weapon.hero` field to `Weapon.owner` in code example to better reflect meaning X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8937d3f6da7db124940ad423eb46b4a2cbf9daf;p=thirdparty%2Ffastapi%2Fsqlmodel.git Rename `Weapon.hero` field to `Weapon.owner` in code example to better reflect meaning --- 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 aa850b3f..a759c839 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 fc0d08df..3cb510eb 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")