【问题标题】:syncdb = Error: One or more models did not validatesyncdb = 错误:一个或多个模型未验证
【发布时间】:2012-12-06 15:49:41
【问题描述】:

当我 manage.py syncdb 时,我得到:

Error: One or more models did not validate:
users.userprofile: "uuid": Primary key fields cannot have null=True.

即使我的class UserProfile(models.Model) 有:

uuid = UUIDField(primary_key=True, auto=True, editable=False)

【问题讨论】:

  • UUIDField 来自哪里?它是否可能默认为null=True?如果是这样,您可以通过专门设置null=False 在您的声明中覆盖它吗?

标签: django uuid django-south


【解决方案1】:

Daniel的评论大概就是这个了,我就是不知道怎么追。

来自Joshua 的修复是删除官方django-uuidfield 并用Joshua 的fork 替换它们。

-django-uuidfield==0.4
-django-uuidfield-2==0.6.5
+# django-uuidfield==0.4
+# django-uuidfield-2==0.6.5
+-e git://github.com/joshuakarjala/django-uuidfield.git#egg=django-uuidfield

记住pip uninstall django-uuidfieldpip uninstall django-uuidfield-2pip install -r requirements.txt 之前。

【讨论】:

    猜你喜欢
    • 2011-02-06
    • 2014-03-07
    • 2013-02-13
    • 2013-04-06
    • 1970-01-01
    • 2015-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多