]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Clarity fix for assocproxy example code
authorJason Kirtland <jek@discorporate.us>
Wed, 18 Jul 2007 23:25:07 +0000 (23:25 +0000)
committerJason Kirtland <jek@discorporate.us>
Wed, 18 Jul 2007 23:25:07 +0000 (23:25 +0000)
doc/build/content/plugins.txt

index bfe8d2e54cbf44325b9c7f8c867fa7178a43f71e..dbc85a6f99e9a89acb86e631ad8ac4644d69a0a4 100644 (file)
@@ -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>]