On Tue, 2009-05-05 at 06:02 -0700, Chris McComas wrote:
> I have a site/database that tracks baseball players and their agents.
> Players can have multiple agents at one time, they also can fire
> agents and hire new ones at anytime, and I'd like to track all of
> their agents, current, or previous. I was thinking of this schema for
> my models, but wasn't sure the best way to handle the previous agents,
> etc. Also, players can rehire a previous agent...
> 
> Would it be best to have another model that has a FK to player and MTM
> to agent with the dates of hire, fired?
> 
> http://dpaste.com/41109/

I think you're thinking along the right lines. Since you already have
Player and Agent objects, you only have to model the relationship
between them. It seems to me this is a many-to-many relationship with
some extra information on the intermediate table: the start and
(nullable) end dates of the relationship.

This is an ideal situation for ManyToManyField(through=....), where the
"through" table contains the two dates, as well as ForeignKeys to the
Player and Agent models.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to