Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added Model.__str__() default fallback, and changed Model.__repr__() …

…to embed Model.__str__() within it

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit de3edb74c58b1d2db6e65c7eeb185e96f9880b1f 1 parent 887131c
@adrianholovaty adrianholovaty authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/db/models/
5 django/db/models/
@@ -69,7 +69,10 @@ def _get_pk_val(self):
return getattr(self,
def __repr__(self):
- return '<%s object>' % self.__class__.__name__
+ return '<%s: %s>' % (self.__class__.__name__, self)
+ def __str__(self):
+ return '%s object' % self.__class__.__name__
def __eq__(self, other):
return isinstance(other, self.__class__) and self._get_pk_val() == other._get_pk_val()
Please sign in to comment.
Something went wrong with that request. Please try again.