]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix missing back_populates in Note.item relationship in example code (#12925)
authorkrave1986 <krave@qq.com>
Mon, 20 Oct 2025 20:06:31 +0000 (04:06 +0800)
committerGitHub <noreply@github.com>
Mon, 20 Oct 2025 20:06:31 +0000 (22:06 +0200)
Without back_populates, the subsequent code would not automatically populate Item.notes or generate the key, which contradicts what the documentation intends to demonstrate.

doc/build/orm/collection_api.rst

index d1fbe8c00b0546d793351d8eaa64df8d7005b94a..a04160edee2671c4d278689de35be0f1deb2c2e9 100644 (file)
@@ -220,7 +220,7 @@ of the ``Note.text`` field::
         keyword: Mapped[str]
         text: Mapped[str]
 
-        item: Mapped["Item"] = relationship()
+        item: Mapped["Item"] = relationship(back_populates="notes")
 
         @property
         def note_key(self):