On 17 Oct, 2005, at 2:03 am, gps wrote:
"Two attributes will generally be created, role, which returns a Role
instance, and roleID, which returns an integer ID for the related
role." - SQLObject 0.7 documentation when talking about what
ForeignKey
does.
Thanks, but I *have* read the documentation. Furthermore, I'm not
interested in the ForeignKey. I'm interested in the *other* side of
the relationship.
Take the following example:
class Group(SQLObject):
'''
An ultra-simple group definition.
'''
_connection= hub
class sqlmeta:
table="group_table"
groupId= StringCol( alternateID=True )
displayName= StringCol()
created= DateTimeCol( default=datetime.now )
# collection of all users belonging to this group
users= RelatedJoin( "User" )
# collection of all permissions for this group
permissions= RelatedJoin( "Permission" )
class Permission(SQLObject):
_connection= hub
class sqlmeta:
table="permission"
permissionId= StringCol( alternateID=True )
description= StringCol()
groups= RelatedJoin( "Group" )
I would like to be able to spit out the IDs of the Permission objects
associated with a Group when transforming the Group into a JSONable
object. Currently, Ian's code loops through all the columns in the
sqlmeta object, but that obviously doesn't pick up the joins (there's
a specific join property on sqlmeta for that).
Of course, I can call get on each Join object, but that retrieves all
the actual objects. Not just the IDs.
But in order to ever finish the admin console for the Identity
Management framework, I'll have to compromise.
--
Jeff Watkins
http://metrocat.org/
"Not everything that can be counted counts, and not everything that
counts can be counted."
-- Albert Einstein