Opened 11 years ago

Last modified 11 years ago

#19211 closed Cleanup/optimization

1.5 Tutorial wrong about __unicode__() method for Python 3 — at Initial Version

Reported by: adj7388@… Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords: python3 unicode str
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using Python 3.3 and 1.5-alpha-1 (note: underlined unicode() and str() below should have double underscores)

See this section of the tutorial "Why unicode() and not str()?": https://docs.djangoproject.com/en/1.5/intro/tutorial01/#playing-with-the-api

This section of the tutorial says to add unicode() method to your Model classes so that admin and shell display useful strings. This is correct for Python 2.x, but breaks object display under Python 3.3. str() should be used instead of unicode(). Tutorial probably needs a sidebar or other additional information for users using Python 3.x.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top