2012-12-06 73 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

相關問題