From 039ce4e00034f872bad5252a7d84dc3028394c5f Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Mon, 25 May 2015 08:35:55 +0900 Subject: [PATCH] Return unicode from _unicode_ methods Import from PyCon improvement. Author: Dan Poirier Date: Mon Jul 8 15:55:33 2013 -0400 Return unicode from __unicode__ methods Signed-off-by: Hiroshi Miura --- symposion/conference/models.py | 2 +- symposion/schedule/models.py | 10 +++++----- symposion/speakers/models.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/symposion/conference/models.py b/symposion/conference/models.py index 354403b6..582035b5 100644 --- a/symposion/conference/models.py +++ b/symposion/conference/models.py @@ -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") diff --git a/symposion/schedule/models.py b/symposion/schedule/models.py index 14ea87e4..a8533abb 100644 --- a/symposion/schedule/models.py +++ b/symposion/schedule/models.py @@ -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"] diff --git a/symposion/speakers/models.py b/symposion/speakers/models.py index b5705bcc..0887ef45 100644 --- a/symposion/speakers/models.py +++ b/symposion/speakers/models.py @@ -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")