Author: mtredinnick
Date: 2007-04-21 23:55:42 -0500 (Sat, 21 Apr 2007)
New Revision: 5059
Modified:
django/branches/unicode/django/contrib/auth/models.py
django/branches/unicode/django/contrib/contenttypes/models.py
django/branches/unicode/django/contrib/flatpages/models.py
django/branches/unicode/django/contrib/redirects/models.py
django/branches/unicode/django/contrib/sites/models.py
Log:
unicode: Fixed #4109 -- Converted internal models to have a __unicode__ method.
In most cases this is just a slight performance improvement (saves on later
conversions), in a few cases it's a good idea because things like
"username" could now be legitimately non-ASCII.
Modified: django/branches/unicode/django/contrib/auth/models.py
===================================================================
--- django/branches/unicode/django/contrib/auth/models.py 2007-04-22
04:21:04 UTC (rev 5058)
+++ django/branches/unicode/django/contrib/auth/models.py 2007-04-22
04:55:42 UTC (rev 5059)
@@ -45,8 +45,8 @@
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 Admin:
search_fields = ('name',)
- def __str__(self):
+ def __unicode__(self):
return self.name
class UserManager(models.Manager):
@@ -122,7 +122,7 @@
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 @@
user = models.ForeignKey(User)
message = models.TextField(_('message'))
- def __str__(self):
+ def __unicode__(self):
return self.message
class AnonymousUser(object):
@@ -272,8 +272,8 @@
def __init__(self):
pass
- def __str__(self):
- return 'AnonymousUser'
+ def __unicode__(self):
+ return u'AnonymousUser'
def __eq__(self, other):
return isinstance(other, self.__class__)
Modified: django/branches/unicode/django/contrib/contenttypes/models.py
===================================================================
--- django/branches/unicode/django/contrib/contenttypes/models.py
2007-04-22 04:21:04 UTC (rev 5058)
+++ django/branches/unicode/django/contrib/contenttypes/models.py
2007-04-22 04:55:42 UTC (rev 5059)
@@ -42,7 +42,7 @@
ordering = ('name',)
unique_together = (('app_label', 'model'),)
- def __str__(self):
+ def __unicode__(self):
return self.name
def model_class(self):
Modified: django/branches/unicode/django/contrib/flatpages/models.py
===================================================================
--- django/branches/unicode/django/contrib/flatpages/models.py 2007-04-22
04:21:04 UTC (rev 5058)
+++ django/branches/unicode/django/contrib/flatpages/models.py 2007-04-22
04:55:42 UTC (rev 5059)
@@ -26,8 +26,8 @@
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
Modified: django/branches/unicode/django/contrib/redirects/models.py
===================================================================
--- django/branches/unicode/django/contrib/redirects/models.py 2007-04-22
04:21:04 UTC (rev 5058)
+++ django/branches/unicode/django/contrib/redirects/models.py 2007-04-22
04:55:42 UTC (rev 5059)
@@ -20,5 +20,5 @@
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)
Modified: django/branches/unicode/django/contrib/sites/models.py
===================================================================
--- django/branches/unicode/django/contrib/sites/models.py 2007-04-22
04:21:04 UTC (rev 5058)
+++ django/branches/unicode/django/contrib/sites/models.py 2007-04-22
04:55:42 UTC (rev 5059)
@@ -19,5 +19,5 @@
list_display = ('domain', 'name')
search_fields = ('domain', 'name')
- def __str__(self):
+ def __unicode__(self):
return self.domain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---