diff options
| author | Collin Anderson <cmawebsite@gmail.com> | 2017-04-08 14:38:48 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-06-09 13:42:53 -0400 |
| commit | 1a49b8947033fd667310b1b996330a8e119fcbf9 (patch) | |
| tree | c6c1154a617e21e0539ef9f8214c0013ce9fb742 /docs | |
| parent | 7c9cb1ed37354c184fe0438ecae923d5be711c86 (diff) | |
Fixed #27953 -- Added instance's pk to Model.__str__().
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/intro/tutorial02.txt | 8 | ||||
| -rw-r--r-- | docs/releases/2.0.txt | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index 48e4ac7e7d..5eca45ee09 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -437,11 +437,11 @@ Once you're in the shell, explore the :doc:`database API </topics/db/queries>`:: # objects.all() displays all the questions in the database. >>> Question.objects.all() - <QuerySet [<Question: Question object>]> + <QuerySet [<Question: Question object (1)>]> -Wait a minute. ``<Question: Question object>`` is, utterly, an unhelpful representation -of this object. Let's fix that by editing the ``Question`` model (in the -``polls/models.py`` file) and adding a +Wait a minute. ``<Question: Question object (1)>`` isn't a helpful +representation of this object. Let's fix that by editing the ``Question`` model +(in the ``polls/models.py`` file) and adding a :meth:`~django.db.models.Model.__str__` method to both ``Question`` and ``Choice``: diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index de5559a7eb..5214b3f2f5 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -441,6 +441,9 @@ Miscellaneous :class:`~django.views.i18n.JavaScriptCatalog` view now raises ``ValueError`` instead of passing silently. +* A model instance's primary key now appears in the default ``Model.__str__()`` + method, e.g. ``Question object (1)``. + .. _deprecated-features-2.0: Features deprecated in 2.0 |
