syncdb = Error: One or more models did not validate

你。 提交于 2019-12-12 05:27:08

问题


When I do manage.py syncdb I get:

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

even though my class UserProfile(models.Model) have:

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

回答1:


The comment from Daniel was probably it, I just didn't know how to follow the clue.

The fix, that came from Joshua, was to remove the official django-uuidfield's and replace them with Joshua's 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

Remember to pip uninstall django-uuidfield and pip uninstall django-uuidfield-2 before pip install -r requirements.txt.



来源:https://stackoverflow.com/questions/13747335/syncdb-error-one-or-more-models-did-not-validate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!