diff options
-rw-r--r-- | project/scipycon/base/admin.py | 8 | ||||
-rw-r--r-- | project/scipycon/base/models.py | 56 |
2 files changed, 35 insertions, 29 deletions
diff --git a/project/scipycon/base/admin.py b/project/scipycon/base/admin.py index bf3f5b2..118808d 100644 --- a/project/scipycon/base/admin.py +++ b/project/scipycon/base/admin.py @@ -10,7 +10,7 @@ class EventAdmin(admin.ModelAdmin): search_fields = ('name', 'turn', 'status',) fieldsets = ( ('Details', { - 'fields': ('name', 'turn', 'status', 'scope', 'timeline') + 'fields': ('name', 'turn', 'status', 'scope') }), ) @@ -19,11 +19,11 @@ class TimelineAdmin(admin.ModelAdmin): 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 @@ class TimelineAdmin(admin.ModelAdmin): 'proceedings_paper_deadline') }), ('Event', { - 'fields': ('event_start', 'event_end') + 'fields': ('event_start', 'event_end', 'event') }), ) diff --git a/project/scipycon/base/models.py b/project/scipycon/base/models.py index 861a232..9041e77 100644 --- a/project/scipycon/base/models.py +++ b/project/scipycon/base/models.py @@ -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 @@ class Timeline(models.Model): # 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): |