provide string representations for schedule models
This commit is contained in:
parent
e26b9c2678
commit
3b46ba3012
1 changed files with 15 additions and 0 deletions
|
@ -11,6 +11,9 @@ from symposion.conference.models import Section
|
||||||
class Schedule(models.Model):
|
class Schedule(models.Model):
|
||||||
|
|
||||||
section = models.OneToOneField(Section)
|
section = models.OneToOneField(Section)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return "%s Schedule" % self.section
|
||||||
|
|
||||||
|
|
||||||
class Day(models.Model):
|
class Day(models.Model):
|
||||||
|
@ -18,6 +21,9 @@ class Day(models.Model):
|
||||||
schedule = models.ForeignKey(Schedule)
|
schedule = models.ForeignKey(Schedule)
|
||||||
date = models.DateField()
|
date = models.DateField()
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return "%s" % self.date
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = [("schedule", "date")]
|
unique_together = [("schedule", "date")]
|
||||||
|
|
||||||
|
@ -40,6 +46,9 @@ class SlotKind(models.Model):
|
||||||
|
|
||||||
schedule = models.ForeignKey(Schedule)
|
schedule = models.ForeignKey(Schedule)
|
||||||
label = models.CharField(max_length=50)
|
label = models.CharField(max_length=50)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.label
|
||||||
|
|
||||||
|
|
||||||
class Slot(models.Model):
|
class Slot(models.Model):
|
||||||
|
@ -81,6 +90,9 @@ class Slot(models.Model):
|
||||||
@property
|
@property
|
||||||
def rooms(self):
|
def rooms(self):
|
||||||
return Room.objects.filter(pk__in=self.slotroom_set.values("room"))
|
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):
|
class SlotRoom(models.Model):
|
||||||
|
@ -91,6 +103,9 @@ class SlotRoom(models.Model):
|
||||||
slot = models.ForeignKey(Slot)
|
slot = models.ForeignKey(Slot)
|
||||||
room = models.ForeignKey(Room)
|
room = models.ForeignKey(Room)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return "%s %s" % (self.room, self.slot)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = [("slot", "room")]
|
unique_together = [("slot", "room")]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue