Changeset 3072
- Timestamp:
- 06/03/06 17:14:04 (2 years ago)
- Files:
-
- django/trunk/tests/modeltests/str (moved) (moved from django/trunk/tests/modeltests/repr)
- django/trunk/tests/modeltests/str/models.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/modeltests/str/models.py
r2809 r3072 1 1 """ 2 2. Adding __ repr__() to models2 2. Adding __str__() to models 3 3 4 Although it's not a strict requirement, each model should have a ``__ repr__()``4 Although it's not a strict requirement, each model should have a ``__str__()`` 5 5 method to return a "human-readable" representation of the object. Do this not 6 6 only for your own sanity when dealing with the interactive prompt, but also … … 15 15 pub_date = models.DateTimeField() 16 16 17 def __ repr__(self):17 def __str__(self): 18 18 return self.headline 19 19 … … 24 24 >>> a.save() 25 25 26 >>> repr(a)26 >>> str(a) 27 27 'Area man programs in Python' 28 28 29 29 >>> a 30 Area man programs in Python 30 <Article: Area man programs in Python> 31 31 """
