mirror of
https://github.com/django/django.git
synced 2025-08-10 05:48:15 +00:00
[1.6.x] Fixed #20224 -- Update docs examples which mention __unicode__
Thanks Marc Tamlyn and Tim Graham for the review.
Backport of 7442eb1a24
from master.
This commit is contained in:
parent
430aae1b0d
commit
a9dd6221af
24 changed files with 65 additions and 24 deletions
|
@ -31,6 +31,7 @@ the file ``mysite/news/models.py``::
|
|||
class Reporter(models.Model):
|
||||
full_name = models.CharField(max_length=70)
|
||||
|
||||
# On Python 3: def __str__(self):
|
||||
def __unicode__(self):
|
||||
return self.full_name
|
||||
|
||||
|
@ -40,6 +41,7 @@ the file ``mysite/news/models.py``::
|
|||
content = models.TextField()
|
||||
reporter = models.ForeignKey(Reporter)
|
||||
|
||||
# On Python 3: def __str__(self):
|
||||
def __unicode__(self):
|
||||
return self.headline
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue