[SQL-CVS] r3267 - SQLObject/branches/0.10/docs
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2008-02-28 07:43:26
|
Author: phd Date: 2008-02-28 00:43:17 -0700 (Thu, 28 Feb 2008) New Revision: 3267 Modified: SQLObject/branches/0.10/docs/FAQ.txt SQLObject/branches/0.10/docs/SQLObject.txt Log: Documentation update: MultipleJoin for the intermediate table. Modified: SQLObject/branches/0.10/docs/FAQ.txt =================================================================== --- SQLObject/branches/0.10/docs/FAQ.txt 2008-02-28 07:42:59 UTC (rev 3266) +++ SQLObject/branches/0.10/docs/FAQ.txt 2008-02-28 07:43:17 UTC (rev 3267) @@ -108,8 +108,8 @@ --------------------------------------------------------------------------- .. note:: - In User and Role, SQLRelatedJoin is used with createRelatedTable=False - so the intermediate table is not created automatically. We also set the + In User and Role, SQLRelatedJoin is used with createRelatedTable=False + so the intermediate table is not created automatically. We also set the intermediate table name with intermediateTable='user_roles'. UserRoles is the definition of our intermediate table. UserRoles creates a unique index to make sure we don't have duplicate @@ -117,10 +117,12 @@ We also added an extra field called active which has a boolean value. The active column might be used to activate/deactivate a given role for a user in this example. - Another common field to add in this an intermediate table might be a sort + Another common field to add in this an intermediate table might be a sort field. + If you want to get a list of rows from the intermediate table directly + add a MultipleJoin to User or Role class. -We'll expand on the User and Role example and define our own UserRoles class which +We'll expand on the User and Role example and define our own UserRoles class which will be the intermediate table for the User and Role Many-to-Many relationship. Example:: Modified: SQLObject/branches/0.10/docs/SQLObject.txt =================================================================== --- SQLObject/branches/0.10/docs/SQLObject.txt 2008-02-28 07:42:59 UTC (rev 3266) +++ SQLObject/branches/0.10/docs/SQLObject.txt 2008-02-28 07:43:17 UTC (rev 3267) @@ -507,6 +507,8 @@ containing the foreign keys for the MTM relationship, and an additional DateTimeCol defaulting to datetime.datetime.now : that column will stay empty when adding roles with the addRole method. +If you want to get a list of rows from the intermediate table directly +add a MultipleJoin to User or Role class. You may notice that the columns have the extra keyword argument `alternateID`. If you use ``alternateID=True``, this means that the |