Author: adrian
Date: 2006-06-03 17:14:04 -0500 (Sat, 03 Jun 2006)
New Revision: 3072
Added:
django/trunk/tests/modeltests/str/
Removed:
django/trunk/tests/modeltests/repr/
Modified:
django/trunk/tests/modeltests/str/models.py
Log:
Fixed #2077 -- Renamed 'repr' model tests to 'str'
Copied: django/trunk/tests/modeltests/str (from rev 3070,
django/trunk/tests/modeltests/repr)
Modified: django/trunk/tests/modeltests/str/models.py
===================================================================
--- django/trunk/tests/modeltests/repr/models.py 2006-06-03 13:37:34 UTC
(rev 3070)
+++ django/trunk/tests/modeltests/str/models.py 2006-06-03 22:14:04 UTC (rev
3072)
@@ -1,7 +1,7 @@
"""
-2. Adding __repr__() to models
+2. Adding __str__() to models
-Although it's not a strict requirement, each model should have a ``__repr__()``
+Although it's not a strict requirement, each model should have a ``__str__()``
method to return a "human-readable" representation of the object. Do this not
only for your own sanity when dealing with the interactive prompt, but also
because objects' representations are used throughout Django's
@@ -14,7 +14,7 @@
headline = models.CharField(maxlength=100)
pub_date = models.DateTimeField()
- def __repr__(self):
+ def __str__(self):
return self.headline
API_TESTS = """
@@ -23,9 +23,9 @@
>>> a = Article(headline='Area man programs in Python',
>>> pub_date=datetime(2005, 7, 28))
>>> a.save()
->>> repr(a)
+>>> str(a)
'Area man programs in Python'
>>> a
-Area man programs in Python
+<Article: Area man programs in Python>
"""
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---