Thursday, February 11, 2016

__unicode__ rather than __str__ in Part 2 of 'Writing you first Django app"?

In "Writing your first Django app, part 2" (https://docs.djangoproject.com/en/1.9/intro/tutorial02/), it's outlines adding a __str__() method  to your models.

But if you've got a unicode string that's called in the admin, you're going to get a big, unfriendly UnicodeEncodeError error when you load that admin change_form.html.

Wouldn't it be safer/better newbie user experience to go with a __unicode__ method instead?

— John

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b91cb5be-ea46-46af-9e81-344b610d124b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment