mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #21951 -- Updated docs to use __str__ for Python 3
Thanks Tim Graham for the report and recommendations
This commit is contained in:
parent
c3434fed5b
commit
8aa1efff6d
20 changed files with 71 additions and 72 deletions
|
@ -89,8 +89,7 @@ We'll be using these models::
|
|||
class Meta:
|
||||
ordering = ["-name"]
|
||||
|
||||
# On Python 3: def __str__(self):
|
||||
def __unicode__(self):
|
||||
def __str__(self): # __unicode__ on Python 2
|
||||
return self.name
|
||||
|
||||
class Author(models.Model):
|
||||
|
@ -99,8 +98,7 @@ We'll be using these models::
|
|||
email = models.EmailField()
|
||||
headshot = models.ImageField(upload_to='author_headshots')
|
||||
|
||||
# On Python 3: def __str__(self):
|
||||
def __unicode__(self):
|
||||
def __str__(self): # __unicode__ on Python 2
|
||||
return self.name
|
||||
|
||||
class Book(models.Model):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue