Yes, try something like this:
class Item(SQLObject):
name = StringCol(notNull=True, alternateID=True)
groups = SQLRelatedJoin('Group', createRelatedTable=False)
class Group(SQLObject):
name = StringCol(notNull=True, alternateID=True)
items = SQLRelatedJoin('Item', createRelatedTable=False)
class GroupItem(SQLObject):
class sqlmeta:
table = 'group_item'
group = ForeignKey('Group', notNull=True)
item = ForeignKey('Item', notNull=True)
position = IntCol(notNull=True, default=999)
unique = index.DatabaseIndex(group, item, unique=True)
--
Rick
On Thu, 20 Jul 2006, Jonathon Anderson wrote:
> Is it possible to have relation attributes in a RelatedJoin?
>
> For example, I have Items and Groups:
>
> Item
> ID
> Name
>
>
> Group
> ID
> Name
>
> To put items in groups, you would have an intermediate table:
>
> ItemGroupMap
> item_id
> group_id
>
> Now say I want this group to have order. So, in an RDB I would change
> ItemGroupMap to:
>
> ItemGroupMap
> item_id
> group_id
> position
> unique(group_id, position)
>
> Is there a way to have this relationship in sqlobject?
>
> ~jonathon
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss