# HG changeset patch # User Madhusudan.C.S # Date 1279658133 -19800 # Node ID 267d9eee024b8fb013c4bf53ab3f27ded36af9c5 # Parent 782f958b2cb2f92191c8dea64bbfe22481498cc8 Made Timeline model to refer to Event model not vice-versa. diff -r 782f958b2cb2 -r 267d9eee024b project/scipycon/base/admin.py --- a/project/scipycon/base/admin.py Wed Jul 21 02:04:48 2010 +0530 +++ b/project/scipycon/base/admin.py Wed Jul 21 02:05:33 2010 +0530 @@ -10,7 +10,7 @@ search_fields = ('name', 'turn', 'status',) fieldsets = ( ('Details', { - 'fields': ('name', 'turn', 'status', 'scope', 'timeline') + 'fields': ('name', 'turn', 'status', 'scope') }), ) @@ -19,11 +19,11 @@ list_display = ('registration_start', 'registration_end', 'cfp_start', 'cfp_end', 'accepted_papers_announced', 'proceedings_paper_deadline', 'event_start', - 'event_end') + 'event_end', 'event') list_filter = ('registration_start', 'registration_end', 'cfp_start', 'cfp_end', 'accepted_papers_announced', 'proceedings_paper_deadline', 'event_start', - 'event_end') + 'event_end', 'event') search_fields = ('registration_start', 'registration_end', 'cfp_start', 'cfp_end', 'accepted_papers_announced', 'proceedings_paper_deadline', 'event_start', @@ -37,7 +37,7 @@ 'proceedings_paper_deadline') }), ('Event', { - 'fields': ('event_start', 'event_end') + 'fields': ('event_start', 'event_end', 'event') }), ) diff -r 782f958b2cb2 -r 267d9eee024b project/scipycon/base/models.py --- a/project/scipycon/base/models.py Wed Jul 21 02:04:48 2010 +0530 +++ b/project/scipycon/base/models.py Wed Jul 21 02:05:33 2010 +0530 @@ -1,10 +1,39 @@ from django.db import models +class Event(models.Model): + """Data model which holds the data related to the scope or the event. + """ + + # Different states the Event can be in + STATUS_CHOICES = ( + ('active', 'Active'), + ('inactive', 'Inactive'), + ) + + # Scope of the program, used as a URL prefix + scope = models.CharField(max_length=255) + + # Name of the program + name = models.CharField(max_length=255) + + # Event specific i.e version of the event + turn = models.CharField(max_length=255) + + # Status of the program + status = models.CharField(max_length=255, choices=STATUS_CHOICES) + + def __unicode__(self): + return '%s %s' % (self.name, self.turn) + + class Timeline(models.Model): """Timeline of the program """ + # Event with which this timeline is associated + event = models.OneToOneField(Event) + # Start of registration for the program registration_start = models.DateTimeField(blank=True, null=True) @@ -29,31 +58,8 @@ # End of the actual program event_end = models.DateTimeField(blank=True, null=True) - -class Event(models.Model): - """Data model which holds the data related to the scope or the event. - """ - - # Different states the Event can be in - STATUS_CHOICES = ( - ('active', 'Active'), - ('inactive', 'Inactive'), - ) - - # Scope of the program, used as a URL prefix - scope = models.CharField(max_length=255) - - # Name of the program - name = models.CharField(max_length=255) - - # Event specific i.e version of the event - turn = models.CharField(max_length=255) - - # Time associated with the program - timeline = models.OneToOneField(Timeline) - - # Status of the program - status = models.CharField(max_length=255, choices=STATUS_CHOICES) + def __unicode__(self): + return '%s %s' % (self.event.name, self.event.turn) class ScopedBase(models.Model):