From 65121ca59e92b93fd7ddbd1d879024e208fdcb9d Mon Sep 17 00:00:00 2001 From: Jason Kirtland Date: Wed, 18 Jul 2007 23:25:07 +0000 Subject: [PATCH] Clarity fix for assocproxy example code --- doc/build/content/plugins.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/build/content/plugins.txt b/doc/build/content/plugins.txt index bfe8d2e54c..dbc85a6f99 100644 --- a/doc/build/content/plugins.txt +++ b/doc/build/content/plugins.txt @@ -303,6 +303,14 @@ To continue the `MyClass` example: primary_key=True) ) + class User(object): + def __init__(self, name): + self.name = name + + class Keyword(object): + def __init__(self, keyword): + self.keyword = keyword + mapper(User, users, properties={ 'kw': relation(Keyword, secondary=userkeywords) }) @@ -324,6 +332,7 @@ With ``association_proxy`` you have a "view" of the relation that contains just {python} from sqlalchemy.ext.associationproxy import association_proxy + class User(object): def __init__(self, name): self.name = name @@ -331,10 +340,6 @@ With ``association_proxy`` you have a "view" of the relation that contains just # proxy the 'keyword' attribute from the 'kw' relation keywords = association_proxy('kw', 'keyword') - class Keyword(object): - def __init__(self, keyword): - self.keyword = keyword - # ... >>> user.kw [<__main__.Keyword object at 0xb791ea0c>] -- 2.47.3