From a9dd6221af2148410c8a26dcbafd1ff8cc0fb107 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 4 Jul 2013 15:19:33 +0200 Subject: [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. --- docs/ref/contrib/admin/actions.txt | 1 + docs/ref/contrib/admin/index.txt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'docs/ref/contrib/admin') diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt index c79f978850..65d096921f 100644 --- a/docs/ref/contrib/admin/actions.txt +++ b/docs/ref/contrib/admin/actions.txt @@ -57,6 +57,7 @@ simple news application with an ``Article`` model:: body = models.TextField() status = models.CharField(max_length=1, choices=STATUS_CHOICES) + # On Python 3: def __str__(self): def __unicode__(self): return self.title diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 318ce297a2..70db52941c 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -438,7 +438,8 @@ subclass:: list_display = ('first_name', 'last_name') If you don't set ``list_display``, the admin site will display a single - column that displays the ``__unicode__()`` representation of each object. + column that displays the ``__unicode__()`` (``__str__()`` on Python 3) + representation of each object. You have four possible values that can be used in ``list_display``: @@ -488,7 +489,7 @@ subclass:: A few special cases to note about ``list_display``: * If the field is a ``ForeignKey``, Django will display the - ``__unicode__()`` of the related object. + ``__unicode__()`` (``__str__()`` on Python 3) of the related object. * ``ManyToManyField`` fields aren't supported, because that would entail executing a separate SQL statement for each row in the table. -- cgit v1.3