provide string representations for schedule models

This commit is contained in:
Luke Hatcher 2012-11-25 13:26:25 -05:00
parent e26b9c2678
commit 3b46ba3012

View file

@ -11,6 +11,9 @@ from symposion.conference.models import Section
class Schedule(models.Model):
section = models.OneToOneField(Section)
def __unicode__(self):
return "%s Schedule" % self.section
class Day(models.Model):
@ -18,6 +21,9 @@ class Day(models.Model):
schedule = models.ForeignKey(Schedule)
date = models.DateField()
def __unicode__(self):
return "%s" % self.date
class Meta:
unique_together = [("schedule", "date")]
@ -40,6 +46,9 @@ class SlotKind(models.Model):
schedule = models.ForeignKey(Schedule)
label = models.CharField(max_length=50)
def __unicode__(self):
return self.label
class Slot(models.Model):
@ -81,6 +90,9 @@ class Slot(models.Model):
@property
def rooms(self):
return Room.objects.filter(pk__in=self.slotroom_set.values("room"))
def __unicode__(self):
return "%s %s (%s - %s)" % (self.day, self.kind, self.start, self.end)
class SlotRoom(models.Model):
@ -91,6 +103,9 @@ class SlotRoom(models.Model):
slot = models.ForeignKey(Slot)
room = models.ForeignKey(Room)
def __unicode__(self):
return "%s %s" % (self.room, self.slot)
class Meta:
unique_together = [("slot", "room")]