From d98f9b82a85b2d9d7a8ebc36beca1f0cd9342894 Mon Sep 17 00:00:00 2001 From: Luke Hatcher Date: Thu, 20 Dec 2012 01:53:22 -0500 Subject: [PATCH] add default ordering to schedule models --- symposion/schedule/models.py | 7 +++++++ symposion/schedule/views.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/symposion/schedule/models.py b/symposion/schedule/models.py index 17953ac4..ab422948 100644 --- a/symposion/schedule/models.py +++ b/symposion/schedule/models.py @@ -93,6 +93,9 @@ class Slot(models.Model): def __unicode__(self): return "%s %s (%s - %s)" % (self.day, self.kind, self.start, self.end) + + class Meta: + ordering = ["day", "start", "end"] class SlotRoom(models.Model): @@ -108,6 +111,7 @@ class SlotRoom(models.Model): class Meta: unique_together = [("slot", "room")] + ordering = ["slot", "room__order"] class Presentation(models.Model): @@ -139,3 +143,6 @@ class Presentation(models.Model): def __unicode__(self): return "#%s %s (%s)" % (self.number, self.title, self.speaker) + + class Meta: + ordering = ["slot"] diff --git a/symposion/schedule/views.py b/symposion/schedule/views.py index f88d01f4..f9518e33 100644 --- a/symposion/schedule/views.py +++ b/symposion/schedule/views.py @@ -61,7 +61,7 @@ def schedule_list(request, slug=None): schedule = fetch_schedule(slug) presentations = Presentation.objects.filter(section=schedule.section) - presentations = presentations.exclude(cancelled=True).order_by("id") + presentations = presentations.exclude(cancelled=True) ctx = { "schedule": schedule,