Ticket #2077: models.py.diff

File models.py.diff, 881 bytes (added by asmodai@…, 9 years ago)

Patch for repr/models.py to fix the repr calls to str

  • tests/modeltests/repr/models.py

     
    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
    77because objects' representations are used throughout Django's
     
    1414    headline = models.CharField(maxlength=100)
    1515    pub_date = models.DateTimeField()
    1616
    17     def __repr__(self):
     17    def __str__(self):
    1818        return self.headline
    1919
    2020API_TESTS = """
Back to Top