2012-12-06 46 views
0

当我做manage.py syncdb我得到:执行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) 
+4

UUIDField从哪里来?它可能默认为'null = True'?如果是这样,你可以通过专门设置'null = False'来覆盖它吗? –

回答

0

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 install -r requirements.txt之前记得pip uninstall django-uuidfieldpip uninstall django-uuidfield-2

相关问题