Hi all,
I'm trying to convert a web application to use sqlobject, and not sure of
the best way to express the following table relationship:

* User table: the users of the system
* Club table: clubs that users can belong to
* Role table: the possible positions for users in clubs (President,
Treasurer, Member, etc.)
* clubmembers table:
  CREATE TABLE clubmembers` (
    club int NOT NULL,
    user int NOT NULL,
    role int NOT NULL
  )

This is basically a "many-to-many" relationship between User and Club, but
with an added wrinkle... when running Club.Users() I would like to get the
Role of each user as well.

Is there any "pretty" way to do this with sqlobject?  I'm thinking it'd be
nice to be able to do something like:
  club = Club.get(1)
  users = c.Users()
  for u in users: print u.Name, u.Role

It's a lot like the user/role example in the docs, but whenever you have
an association between a User and a Club, you should get a third piece of
information about the Role "automatically".  Hard to explain :-)  Anyone
know a good way to do this?

Thanks!
Dan Lenski


-------------------------------------------------------------------------
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

Reply via email to