provide string representations for schedule models
This commit is contained in:
parent
e26b9c2678
commit
3b46ba3012
1 changed files with 15 additions and 0 deletions
|
@ -12,12 +12,18 @@ class Schedule(models.Model):
|
|||
|
||||
section = models.OneToOneField(Section)
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s Schedule" % self.section
|
||||
|
||||
|
||||
class Day(models.Model):
|
||||
|
||||
schedule = models.ForeignKey(Schedule)
|
||||
date = models.DateField()
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s" % self.date
|
||||
|
||||
class Meta:
|
||||
unique_together = [("schedule", "date")]
|
||||
|
||||
|
@ -41,6 +47,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):
|
||||
|
||||
|
@ -82,6 +91,9 @@ class Slot(models.Model):
|
|||
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")]
|
||||
|
||||
|
|
Loading…
Reference in a new issue