Django

Code

Changeset 3072

Show
Ignore:
Timestamp:
06/03/06 17:14:04 (2 years ago)
Author:
adrian
Message:

Fixed #2077 -- Renamed 'repr' model tests to 'str'

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/modeltests/str/models.py

    r2809 r3072  
    11""" 
    2 2. Adding __repr__() to models 
     22. Adding __str__() to models 
    33 
    4 Although it's not a strict requirement, each model should have a ``__repr__()`` 
     4Although it's not a strict requirement, each model should have a ``__str__()`` 
    55method to return a "human-readable" representation of the object. Do this not 
    66only for your own sanity when dealing with the interactive prompt, but also 
     
    1515    pub_date = models.DateTimeField() 
    1616 
    17     def __repr__(self): 
     17    def __str__(self): 
    1818        return self.headline 
    1919 
     
    2424>>> a.save() 
    2525 
    26 >>> repr(a) 
     26>>> str(a) 
    2727'Area man programs in Python' 
    2828 
    2929>>> a 
    30 Area man programs in Python 
     30<Article: Area man programs in Python> 
    3131"""