Defining the textfield field in Django's model makes it impossible to generate a table in MySQL.

Source: Internet
Author: User

Class talk (models. Model ):
Time = models. datetimefield ()
Content = models. textfield ()

 

After the above model is defined, the information generated by the table cannot be viewed using manage. py syncdb. Of course, the generated table is not seen in the MySQL database. Later I found that it was a problem with textfield. MySQL needed special settings to use this field. Later I saw the following in the Django official document:

 

Textfield

Class
Textfield
([
** Options
]
)

A large text field. The admin represents this as
<Textarea>

 
(A multi-line input ).

Mysql users

If you are using this field with mysqldb 1.2.1p2 and
Utf8_bin

 
Collation (which is
Not
 
The default), there are some issues to be aware of. refer to
MySQL database notes

 
For details.

Specific visible: http://docs.djangoproject.com/en/1.1/ref/models/fields/#textfield

 



Related Article

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.