Django

Code

Changeset 6742

Show
Ignore:
Timestamp:
11/29/07 12:15:31 (1 year ago)
Author:
mtredinnick
Message:

Fixed #5909 -- Made the various django.contrib.comment models more robust in
the face of non-ASCII characters by giving them a unicode method and
letting the default repr use that. Patches from prairiedogg and scompt.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/comments/models.py

    r5848 r6742  
    103103        search_fields = ('comment', 'user__username') 
    104104 
    105     def __repr__(self): 
     105    def __unicode__(self): 
    106106        return "%s: %s..." % (self.user.username, self.comment[:100]) 
    107107 
     
    191191        search_fields = ('comment', 'person_name') 
    192192 
    193     def __repr__(self): 
     193    def __unicode__(self): 
    194194        return "%s: %s..." % (self.person_name, self.comment[:100]) 
    195195 
     
    245245        unique_together = (('user', 'comment'),) 
    246246 
    247     def __repr__(self): 
     247    def __unicode__(self): 
    248248        return _("%(score)d rating by %(user)s") % {'score': self.score, 'user': self.user} 
    249249 
     
    276276        unique_together = (('user', 'comment'),) 
    277277 
    278     def __repr__(self): 
     278    def __unicode__(self): 
    279279        return _("Flag by %r") % self.user 
    280280 
     
    288288        unique_together = (('user', 'comment'),) 
    289289 
    290     def __repr__(self): 
     290    def __unicode__(self): 
    291291        return _("Moderator deletion by %r") % self.user