Wednesday, April 23, 2014

Model Design, Nesting by Year

I'm in the process of designing an internal system and I'm having trouble designing the model so that it will function as I need it.

The basic idea is that everything is "Season" based, where a season is a year (2014, 2015, etc)

From the there we have Events and the the Seasons they are functioning in, (Event 1 (2014, 2015, etc) , Event 2 (2014, 2015, etc))

Then there are people who may be active any given year for a specific Event:

Bob Smith, 2014, Event 1 & Event 2
                  2015, Event 2
                  2016, Event 1

I have created a Season & Event Models:

class EventSeason(models.Model):
    season = models.IntegerField(max_length=4, primary_key=True)

class Event(models.Model):
    attraction = models.CharField(max_length=30, null=True, blank=False)
    seasons = models.ManyToManyField(EventSeason)

I have created the base person model and all the other fields for them (Address, etc) but I'm not sire how I to tie them to the seasons and events so that each season and event pair is maintained going forward. So for example I could historically lookup people from Event 1, 2014, for example. 

Hope this makes sense, thank you for any help,
Chris

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cb81298e-b056-47fe-9b3a-4f4e2e3cfe18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment