当我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)
答案 0 :(得分:0)
来自Daniel的评论可能就是这样,我只是不知道如何理解线索。
来自Joshua的修正方法是删除官方django-uuidfield
并将其替换为约书亚的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-uuidfield
之前请记得pip uninstall django-uuidfield-2
和pip install -r requirements.txt
。