The need string or buffer, int found, and djangobuffer messages are displayed when the added data is saved in django admin.

Source: Internet
Author: User

The need string or buffer, int found, and djangobuffer messages are displayed when the added data is saved in django admin.

Cause

Def _ unicode _ (self): return unicode (self. pk)

If unicode is not found, this error is reported because the encoding is incorrect.

It is because the file is not added with UTF-8 at the beginning, but it is still incorrect.

See http://stackoverflow.com/questions/5345400/django-coercing-to-unicode-need-string-or-buffer-int-found

 

Take a closer look:

The _ unicode _ () method can be processed to return the string representation of an object.
Here is the default value, so if you are not a string, an error will occur. Change it to str () and try again.

It turns out that it is also possible.

 

See http://www.cnblogs.com/wenjiashe521/archive/2012/12/24/2831196.html for Reference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.