summaryrefslogtreecommitdiff
path: root/examples/backref/backref_tree.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/backref/backref_tree.py')
-rw-r--r--examples/backref/backref_tree.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/backref/backref_tree.py b/examples/backref/backref_tree.py
index 3f81b1145..d217b22f1 100644
--- a/examples/backref/backref_tree.py
+++ b/examples/backref/backref_tree.py
@@ -19,7 +19,7 @@ table.create()
mapper(Tree, table,
properties={
- 'childs':relation(Tree, foreignkey=table.c.father_id, primaryjoin=table.c.father_id==table.c.id, backref=backref('father', uselist=False, foreignkey=table.c.id))},
+ 'childs':relation(Tree, foreignkey=table.c.father_id, primaryjoin=table.c.father_id==table.c.id, backref=backref('father', foreignkey=table.c.id))},
)
root = Tree('root')
@@ -27,6 +27,9 @@ child1 = Tree('child1', root)
child2 = Tree('child2', root)
child3 = Tree('child3', child1)
+child4 = Tree('child4')
+child1.childs.append(child4)
+
session = create_session()
session.save(root)
session.flush()