I initially implemented using __str__ (without much thought). Then in some cases, started seeing unicode decode errors in template views if a user inputs international characters. Switching to __unicode__ resolved this category of issues.
That was the practical difference, for me, between __str__ and __unicode__ in the models. On Dec 28, 1:20 pm, Alexander Kojevnikov <[email protected]> wrote: > > > your suggestions to override methods worked a treat. Overriding at the > > > Model level suits me very well as it gives me flexibility. One final > > > question (I hope): what is the difference in overriding the > > > __unicode__ and __str__ methods? > > > Unless you're actually dealing with Unicode text, there won't be any > > practical difference. Check the Python docs for the full story. > > Martynas, > > David is absolutely correct, you can use either of them. I suggest to > always use the __unicode__ method unless you have a very good reason > to use __str__. > > Cheers, > Alex > --www.muspy.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" 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 this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
