I'm trying to create more than one RelatedJoin between the same two 
classes.  I need to construct many-to-many relationships between Persons 
and Projects, because:

- one project can have multiple clients (when it's an open-source project)
- one project can have multiple contractors working on it
- one person can work as a contractor on multiple projects
- one person can be the client that pays for multiple projects
- one person can be a client on one project and a contractor on another 
project

Is it possible to do this in SQLObject?  How?

I've tried to represent this simply as:

class Person(SQLObject):
    name = StringCol()
    clientProjects = RelatedJoin("Project")
    contractorProjects = RelatedJoin("Project")

class Project(SQLObject):
    name = StringCol()
    clients = RelatedJoin("Person")
    contractors = RelatedJoin("Person")

But, when I add a client to a project in Catwalk, that client appears as 
a contractor as well on the same project!  Makes sense; for example, I 
shouldn't expect SQLObject to distinguish between two identical 
references to RelatedJoin("Project").  But how can I distinguish the two 
references properly?

I've tried various combinations of using joinColumn, otherColumn, and 
intermediateTable, but no success yet.  The documentation on joinColumn 
and otherColumn is not readily understandable; perhaps a UML diagram of 
the references between the classes and database tables could clarify the 
documentation.  The best luck I've had yet was to specify two 
intermediateTables - one for the project_client relation and one for the 
project_contractor relation.  But, that resulted in all persons being 
added as clients, even when I tried to add them as contractors.

Tim Black

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to