Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20639 closed Cleanup/optimization (invalid)

Documentation talks about __unicode__() which doesn't exist in Python 3.x anymore — at Version 2

Reported by: flabifabi@… Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Luke Plant)

https://docs.djangoproject.com/en/1.5/intro/tutorial01/
On the above mentioned page, the tutorial tells me to write a __unicode__() method to get a human-readable representation of my object. I tried but it didn't work. I then found out that since I'm using Python 3.3 I have to define a method __ str __(). Since there's a block debating whether to use __str__() or __unicode__() anyways, may it would be useful to add a hint for Python 3.x users to always use __str__().

Regards,
Fabian

Change History (2)

comment:1 by Tim Graham, 11 years ago

Resolution: invalid
Status: newclosed

I guess you missed this paragraph: "This tutorial is written for Django 1.5 and Python 2.x. If the Django version doesn’t match, you can refer to the tutorial for your version of Django or update Django to the newest version. If you are using Python 3.x, be aware that your code may need to differ from what is in the tutorial and you should continue using the tutorial only if you know what you are doing with Python 3.x."

The latest version of the tutorial for Django 1.6 has notes for Python 3 (#19211).

comment:2 by Luke Plant, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top