Code

Ticket #2077: models.py.diff

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

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

Line 
1Index: tests/modeltests/repr/models.py
2===================================================================
3--- tests/modeltests/repr/models.py     (revision 3070)
4+++ tests/modeltests/repr/models.py     (working copy)
5@@ -1,7 +1,7 @@
6 """
7-2. Adding __repr__() to models
8+2. Adding __str__() to models
9 
10-Although it's not a strict requirement, each model should have a ``__repr__()``
11+Although it's not a strict requirement, each model should have a ``__str__()``
12 method to return a "human-readable" representation of the object. Do this not
13 only for your own sanity when dealing with the interactive prompt, but also
14 because objects' representations are used throughout Django's
15@@ -14,7 +14,7 @@
16     headline = models.CharField(maxlength=100)
17     pub_date = models.DateTimeField()
18 
19-    def __repr__(self):
20+    def __str__(self):
21         return self.headline
22 
23 API_TESTS = """