add default ordering to schedule models
This commit is contained in:
		
							parent
							
								
									8cc9603814
								
							
						
					
					
						commit
						d98f9b82a8
					
				
					 2 changed files with 8 additions and 1 deletions
				
			
		|  | @ -94,6 +94,9 @@ class Slot(models.Model): | ||||||
|     def __unicode__(self): |     def __unicode__(self): | ||||||
|         return "%s %s (%s - %s)" % (self.day, self.kind, self.start, self.end) |         return "%s %s (%s - %s)" % (self.day, self.kind, self.start, self.end) | ||||||
|      |      | ||||||
|  |     class Meta: | ||||||
|  |         ordering = ["day", "start", "end"] | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class SlotRoom(models.Model): | class SlotRoom(models.Model): | ||||||
|     """ |     """ | ||||||
|  | @ -108,6 +111,7 @@ class SlotRoom(models.Model): | ||||||
|      |      | ||||||
|     class Meta: |     class Meta: | ||||||
|         unique_together = [("slot", "room")] |         unique_together = [("slot", "room")] | ||||||
|  |         ordering = ["slot", "room__order"] | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Presentation(models.Model): | class Presentation(models.Model): | ||||||
|  | @ -139,3 +143,6 @@ class Presentation(models.Model): | ||||||
|      |      | ||||||
|     def __unicode__(self): |     def __unicode__(self): | ||||||
|         return "#%s %s (%s)" % (self.number, self.title, self.speaker) |         return "#%s %s (%s)" % (self.number, self.title, self.speaker) | ||||||
|  |      | ||||||
|  |     class Meta: | ||||||
|  |         ordering = ["slot"] | ||||||
|  |  | ||||||
|  | @ -61,7 +61,7 @@ def schedule_list(request, slug=None): | ||||||
|     schedule = fetch_schedule(slug) |     schedule = fetch_schedule(slug) | ||||||
|      |      | ||||||
|     presentations = Presentation.objects.filter(section=schedule.section) |     presentations = Presentation.objects.filter(section=schedule.section) | ||||||
|     presentations = presentations.exclude(cancelled=True).order_by("id") |     presentations = presentations.exclude(cancelled=True) | ||||||
|      |      | ||||||
|     ctx = { |     ctx = { | ||||||
|         "schedule": schedule, |         "schedule": schedule, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Luke Hatcher
						Luke Hatcher