Model Design, Nesting by Year

20 views
Skip to first unread message

Christopher Grande

unread,
Apr 23, 2014, 3:13:09 PM4/23/14
to django...@googlegroups.com
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

Venkatraman S

unread,
Apr 29, 2014, 7:50:54 AM4/29/14
to django...@googlegroups.com
Why not have separate models for Event and Season and then use an intermediate table to capture the M2M between event occurrences and Person.


--
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...@googlegroups.com.
To post to this group, send email to django...@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.

Reply all
Reply to author
Forward
0 new messages