diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index f686d90e7a..62d5776ef2 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -45,8 +45,8 @@ class Permission(models.Model): unique_together = (('content_type', 'codename'),) ordering = ('content_type', 'codename') - def __str__(self): - return "%s | %s | %s" % (self.content_type.app_label, self.content_type, self.name) + def __unicode__(self): + return u"%s | %s | %s" % (self.content_type.app_label, self.content_type, self.name) class Group(models.Model): """Groups are a generic way of categorizing users to apply permissions, or some other label, to those users. A user can belong to any number of groups. @@ -66,7 +66,7 @@ class Group(models.Model): class Admin: search_fields = ('name',) - def __str__(self): + def __unicode__(self): return self.name class UserManager(models.Manager): @@ -122,7 +122,7 @@ class User(models.Model): list_filter = ('is_staff', 'is_superuser') search_fields = ('username', 'first_name', 'last_name', 'email') - def __str__(self): + def __unicode__(self): return self.username def get_absolute_url(self): @@ -262,7 +262,7 @@ class Message(models.Model): user = models.ForeignKey(User) message = models.TextField(_('message')) - def __str__(self): + def __unicode__(self): return self.message class AnonymousUser(object): @@ -272,8 +272,8 @@ class AnonymousUser(object): def __init__(self): pass - def __str__(self): - return 'AnonymousUser' + def __unicode__(self): + return u'AnonymousUser' def __eq__(self, other): return isinstance(other, self.__class__) diff --git a/django/contrib/contenttypes/models.py b/django/contrib/contenttypes/models.py index 0a5e68f37e..100532e4de 100644 --- a/django/contrib/contenttypes/models.py +++ b/django/contrib/contenttypes/models.py @@ -42,7 +42,7 @@ class ContentType(models.Model): ordering = ('name',) unique_together = (('app_label', 'model'),) - def __str__(self): + def __unicode__(self): return self.name def model_class(self): diff --git a/django/contrib/flatpages/models.py b/django/contrib/flatpages/models.py index 8d0b2c0d90..86a239489d 100644 --- a/django/contrib/flatpages/models.py +++ b/django/contrib/flatpages/models.py @@ -26,8 +26,8 @@ class FlatPage(models.Model): list_filter = ('sites',) search_fields = ('url', 'title') - def __str__(self): - return "%s -- %s" % (self.url, self.title) + def __unicode__(self): + return u"%s -- %s" % (self.url, self.title) def get_absolute_url(self): return self.url diff --git a/django/contrib/redirects/models.py b/django/contrib/redirects/models.py index 60205e29f3..791b9c9091 100644 --- a/django/contrib/redirects/models.py +++ b/django/contrib/redirects/models.py @@ -20,5 +20,5 @@ class Redirect(models.Model): list_filter = ('site',) search_fields = ('old_path', 'new_path') - def __str__(self): - return "%s ---> %s" % (self.old_path, self.new_path) + def __unicode__(self): + return u"%s ---> %s" % (self.old_path, self.new_path) diff --git a/django/contrib/sites/models.py b/django/contrib/sites/models.py index df93c543d2..5bce56eba4 100644 --- a/django/contrib/sites/models.py +++ b/django/contrib/sites/models.py @@ -19,5 +19,5 @@ class Site(models.Model): list_display = ('domain', 'name') search_fields = ('domain', 'name') - def __str__(self): + def __unicode__(self): return self.domain