Return unicode from _unicode_ methods

Import from PyCon improvement.

Author: Dan Poirier <dpoirier@caktusgroup.com>
Date:   Mon Jul 8 15:55:33 2013 -0400

    Return unicode from __unicode__ methods

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
This commit is contained in:
Hiroshi Miura 2015-05-25 08:35:55 +09:00
parent 7ff4c0b4ef
commit 039ce4e000
3 changed files with 7 additions and 7 deletions

View file

@ -59,7 +59,7 @@ class Section(models.Model):
end_date = models.DateField(_("end date"), null=True, blank=True)
def __unicode__(self):
return "%s %s" % (self.conference, self.name)
return u"%s %s" % (self.conference, self.name)
class Meta(object):
verbose_name = _("section")

View file

@ -17,7 +17,7 @@ class Schedule(models.Model):
hidden = models.BooleanField("Hide schedule from overall conference view", default=False)
def __unicode__(self):
return "%s Schedule" % self.section
return u"%s Schedule" % self.section
class Meta:
ordering = ["section"]
@ -29,7 +29,7 @@ class Day(models.Model):
date = models.DateField()
def __unicode__(self):
return "%s" % self.date
return u"%s" % self.date
class Meta:
unique_together = [("schedule", "date")]
@ -124,7 +124,7 @@ class Slot(models.Model):
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)
return u"%s %s (%s - %s)" % (self.day, self.kind, self.start, self.end)
class Meta:
ordering = ["day", "start", "end"]
@ -139,7 +139,7 @@ class SlotRoom(models.Model):
room = models.ForeignKey(Room)
def __unicode__(self):
return "%s %s" % (self.room, self.slot)
return u"%s %s" % (self.room, self.slot)
class Meta:
unique_together = [("slot", "room")]
@ -176,7 +176,7 @@ class Presentation(models.Model):
yield speaker
def __unicode__(self):
return "#%s %s (%s)" % (self.number, self.title, self.speaker)
return u"#%s %s (%s)" % (self.number, self.title, self.speaker)
class Meta:
ordering = ["slot"]

View file

@ -38,7 +38,7 @@ class Speaker(models.Model):
if self.user:
return self.name
else:
return "?"
return u"?"
def get_absolute_url(self):
return reverse("speaker_edit")