summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-07-03 08:44:03 -0400
committerTim Graham <timograham@gmail.com>2013-07-03 08:46:31 -0400
commit4453d8651af4579b3b83d873cadbda0707b7ab2a (patch)
tree522bf7e9ed82e6eed32bb32b4b13a26291887cfc /docs/ref
parent62a9abeff05e4af61878bff7ff615cd298cf0d7e (diff)
[1.5.x] Fixed #20691 -- Added a note for __str__() vs. __unicode__() and Python 3.
Thanks garrison for the suggestion. Backport of 8a679386c3 from master.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/unicode.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/ref/unicode.txt b/docs/ref/unicode.txt
index 784ff33398..3743d0a092 100644
--- a/docs/ref/unicode.txt
+++ b/docs/ref/unicode.txt
@@ -240,6 +240,13 @@ Django will convert it to Unicode when it needs to.
Choosing between ``__str__()`` and ``__unicode__()``
----------------------------------------------------
+.. note::
+
+ If you are on Python 3, you can skip this section because you'll always
+ create ``__str__()`` rather than ``__unicode__()``. If you'd like
+ compatibility with Python 2, you can decorate your model class with
+ :func:`~django.utils.encoding.python_2_unicode_compatible`.
+
One consequence of using Unicode by default is that you have to take some care
when printing data from the model.