#19413: [model].__str__() disagrees with __unicode__() using python3 /
django1.5b1
-------------------------------+-------------------------------
Reporter: xanthraxoid@… | Owner: nobody
Type: Bug | Status: new
Component: Python 3 | Version: 1.5-beta-1
Severity: Normal | Keywords: str unicode admin
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------------
I created a few models, providing each with a __unicode__() method as
described at [1] and in the admin area, when I look at a list of such
objects, each is listed as [Class Name] object rather than the text
representation defined in my __unicode__() methods.
I used python2.7 and got the expected results, I also defined __str__() to
return self.__unicode__() and again got the expected results.
I assume this is something to do with python3's handling of unicode/byte-
strings, but it seems to me that one of the following three is needed:
1) the __str__() function should continue to return the same text
representation as the __unicode__() method unless overridden
2)the admin should use __unicode__() in place of __str__() - along with
any other part of django
3) the docs should be updated to make it clear what I should do in this
situation (I'll stick with defining __str__() to return the same as
__unicode__() for now, but I'd rather not have to, DRY and all that...
[1]
https://docs.djangoproject.com/en/dev/intro/tutorial01/
https://docs.djangoproject.com/en/dev/topics/db/models/
NB eveywhere you see __unicode__(), the bug tracker software has helpfully
converted my double underlines before and after the function name into
underlining the function name - sorry!
Cheers & God bless
Sam "SammyTheSnake" Penny
--
Ticket URL: <https://code.djangoproject.com/ticket/19413>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.