From de3edb74c58b1d2db6e65c7eeb185e96f9880b1f Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 10 May 2006 16:10:07 +0000 Subject: [PATCH] Added Model.__str__() default fallback, and changed Model.__repr__() to embed Model.__str__() within it git-svn-id: http://code.djangoproject.com/svn/django/trunk@2893 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/db/models/base.py b/django/db/models/base.py index 279e95fd19..d847ff7b56 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -69,7 +69,10 @@ class Model(object): return getattr(self, self._meta.pk.attname) 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()