Ticket #9105: model__unicode__method.diff
File model__unicode__method.diff, 779 bytes (added by , 16 years ago) |
---|
-
django/db/models/base.py
268 268 def __repr__(self): 269 269 return smart_str(u'<%s: %s>' % (self.__class__.__name__, unicode(self))) 270 270 271 def __unicode__(self): 272 return u'%s %s' % (self.__class__.__name__, self._get_pk_val()) 273 271 274 def __str__(self): 272 if hasattr(self, '__unicode__'): 273 return force_unicode(self).encode('utf-8') 274 return '%s object' % self.__class__.__name__ 275 return force_unicode(self).encode('utf-8') 275 276 276 277 def __eq__(self, other): 277 278 return isinstance(other, self.__class__) and self._get_pk_val() == other._get_pk_val()