Re: Intermediary Triple Join Table?

2008-04-28 Thread phloopy

It looks like Rails has something called Has Many Through that can
address such a triple join table.  Still no idea how to do it in
Django though...

On Apr 28, 2:47 pm, phloopy <[EMAIL PROTECTED]> wrote:
> I'm trying to figure out how to solve a particular problem in my Model
> design.  If I'm trying to pound a nail with an old shoe or glass
> bottle (google "Pounding A Nail: Old Shoe or Glass Bottle?") feel free
> to suggest a different way to tackle the problem.
>
> I'm building a system that manages sports leagues, hockey is the first
> one I'm worried about but I intend it to be flexible enough for others
> as well.  There are three objects that are involved in this question:
>
> Person: represents anybody involved in the league, has many roles
> (that is, Person's role = models.ManyToManyField(Roles))
> Role: Any given person can be a number of roles in the app.  Some
> examples are roles used for scheduling, such as player (member of a
> team), ref (multiple refs assigned to each game), scorekeeper, goalie
> (for leagues with rotating goalies), but roles would also be used for
> permissions on the app itself, such as Admin, or News Editor, etc.
>
> I'm fine with it up to that point, but getting the people and roles
> related to scheduled games is causing me problems.
>
> Game: A game is many-to-many with Person (Game's people =
> models.ManyToManyField(Person)), but for any given person related to
> the game it must be specified what their role is for that game.  They
> cannot be both a player and a ref, for example.
>
> If I weren't using django models I'd create a intermediary triple join
> table, with fields for player, role, and game.  I can't conceive how
> to do such a thing with Django though, since the intermediary join
> tables are done behind the scenes with ManyToMany relationships and
> seem to support two way relationships only.
>
> Is there a way to accomplish this design with Django Models?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Intermediary Triple Join Table?

2008-04-28 Thread phloopy

I'm trying to figure out how to solve a particular problem in my Model
design.  If I'm trying to pound a nail with an old shoe or glass
bottle (google "Pounding A Nail: Old Shoe or Glass Bottle?") feel free
to suggest a different way to tackle the problem.

I'm building a system that manages sports leagues, hockey is the first
one I'm worried about but I intend it to be flexible enough for others
as well.  There are three objects that are involved in this question:

Person: represents anybody involved in the league, has many roles
(that is, Person's role = models.ManyToManyField(Roles))
Role: Any given person can be a number of roles in the app.  Some
examples are roles used for scheduling, such as player (member of a
team), ref (multiple refs assigned to each game), scorekeeper, goalie
(for leagues with rotating goalies), but roles would also be used for
permissions on the app itself, such as Admin, or News Editor, etc.

I'm fine with it up to that point, but getting the people and roles
related to scheduled games is causing me problems.

Game: A game is many-to-many with Person (Game's people =
models.ManyToManyField(Person)), but for any given person related to
the game it must be specified what their role is for that game.  They
cannot be both a player and a ref, for example.

If I weren't using django models I'd create a intermediary triple join
table, with fields for player, role, and game.  I can't conceive how
to do such a thing with Django though, since the intermediary join
tables are done behind the scenes with ManyToMany relationships and
seem to support two way relationships only.

Is there a way to accomplish this design with Django Models?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---