On Mon, Dec 25, 2006 at 11:48:51PM +0000, Ben Sizer wrote:
> class User(SQLObject):
>     skills = MultipleJoin("Skill", joinColumn="user_id")
>     ... etc ...
> 
> class Skill(SQLObject):
>     """An instance of a skill that a particular user claims to have."""
>     user = ForeignKey("User")
>     stype = ForeignKey("Skilltype")
>     competence = IntCol()
> 
> class Skilltype(SQLObject):
>     """A type of skill, which can be held by many users, to different
> degrees of competence"""
>     name = UnicodeCol(length=255)
> 
> The Skill table links the User table to the Skilltype table. I can't
> use an implicit intermediate table as I need access to the
> 'competence' column, and may add other columns later.

   It seems you want your cake (speed) and eat it (to have access to the
objects) too. (-: I am afraid you have to choose one over the other.
   If you want your objects that's the simplest part:

user = User.get(id)
for skill in user.skills:
   print skill.stype.name, skill.competence

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
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
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to