Django

Code

Changeset 5059

Show
Ignore:
Timestamp:
04/21/07 23:55:42 (2 years ago)
Author:
mtredinnick
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/unicode/django/contrib/auth/models.py

    r5054 r5059  
    4646        ordering = ('content_type', 'codename') 
    4747 
    48     def __str__(self): 
    49         return "%s | %s | %s" % (self.content_type.app_label, self.content_type, self.name) 
     48    def __unicode__(self): 
     49        return u"%s | %s | %s" % (self.content_type.app_label, self.content_type, self.name) 
    5050 
    5151class Group(models.Model): 
     
    6767        search_fields = ('name',) 
    6868 
    69     def __str__(self): 
     69    def __unicode__(self): 
    7070        return self.name 
    7171 
     
    123123        search_fields = ('username', 'first_name', 'last_name', 'email') 
    124124 
    125     def __str__(self): 
     125    def __unicode__(self): 
    126126        return self.username 
    127127 
     
    263263    message = models.TextField(_('message')) 
    264264 
    265     def __str__(self): 
     265    def __unicode__(self): 
    266266        return self.message 
    267267 
     
    273273        pass 
    274274 
    275     def __str__(self): 
    276         return 'AnonymousUser' 
     275    def __unicode__(self): 
     276        return u'AnonymousUser' 
    277277 
    278278    def __eq__(self, other): 
  • django/branches/unicode/django/contrib/contenttypes/models.py

    r4703 r5059  
    4343        unique_together = (('app_label', 'model'),) 
    4444 
    45     def __str__(self): 
     45    def __unicode__(self): 
    4646        return self.name 
    4747 
  • django/branches/unicode/django/contrib/flatpages/models.py

    r4849 r5059  
    2727        search_fields = ('url', 'title') 
    2828 
    29     def __str__(self): 
    30         return "%s -- %s" % (self.url, self.title) 
     29    def __unicode__(self): 
     30        return u"%s -- %s" % (self.url, self.title) 
    3131 
    3232    def get_absolute_url(self): 
  • django/branches/unicode/django/contrib/redirects/models.py

    r4265 r5059  
    2121        search_fields = ('old_path', 'new_path') 
    2222 
    23     def __str__(self): 
    24         return "%s ---> %s" % (self.old_path, self.new_path) 
     23    def __unicode__(self): 
     24        return u"%s ---> %s" % (self.old_path, self.new_path) 
  • django/branches/unicode/django/contrib/sites/models.py

    r4265 r5059  
    2020        search_fields = ('domain', 'name') 
    2121 
    22     def __str__(self): 
     22    def __unicode__(self): 
    2323        return self.domain