【发布时间】:2012-12-25 17:32:03
【问题描述】:
我遇到了这个问题。当我无法将 unicode 字符串分配给 models.CharField 时。
DatabaseError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='")
我找到了this solution,但它似乎对我不起作用。数据库返回此错误:
Error Code: 1025. Error on rename of './test_database/#sql-272e_1ba' to './test_database/[MY_TABLE_NAME]' (errno: 150)
此外,所有这些解决方案似乎只能在创建表后才能工作,或者修改 python manage.py sql APP_NAME 输出并手动创建表。
有没有办法从最初在 python 代码中声明 django 模型时解决这个问题,所以 manage.py syncdb 只会生成正确的表?
【问题讨论】:
标签: django django-models collation django-database