Opened 17 years ago

Closed 17 years ago

#4816 closed (invalid)

__str__ vs. __unicode__ in

Reported by: anonymous Owned by: Jacob
Component: Documentation Version: 0.96
Severity: Keywords: tutorial __str__ __unicode__
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If you change to
USE_I18N = False

then in you have to use

def str(self): rather than unicode

this is not covered in the tutorial part 1 and it took me 30 minutes to guess it. It helps that I'm a pythonista, or I would have not tried it.

Change History (2)

comment:1 by Malcolm Tredinnick, 17 years ago

I haven't worked through the tutorial example in this situation yet, but it certainly isn't true in general. The default model __str__ method (which calls __unicode__ if it exists) has no dependency on the USE_I18N setting.

comment:2 by Malcolm Tredinnick, 17 years ago

Resolution: invalid
Status: newclosed

Looks like the problem here is that you are using version 0.96 of the code (as you indicate in the ticket) and reading the tutorial for the subversion trunk. You need to read the documentation for 0.96 if you are using that version, since unicode support was only added recently.

This has nothing to do with the USE_I18N setting.

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