5
我最近安裝Blogango,在那裏我有以下錯誤:無法爲「CREATED_BY」創建表單字段,但因爲它的相關模式「users.User」尚未加載尚未
CommandError: One or more models did not validate:
blogango.blogentry: 'created_by' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
所以我添加的設置.AUTH_USER_MODEL現在我得到以下信息:
ValueError: Cannot create form field for 'created_by' yet, because its related model 'users.User' has not been loaded yet
我通過我的settings.py它調用AUTH_USER_MODEL = 'users.User'
去了,感動得更高了對settings.py,試圖把它加載更快。
按照要求: created_by = models.ForeignKey(settings.AUTH_USER_MODEL, unique=False)
我能做些什麼來解決這個問題?
我們可以看到'created_by'的模型嗎? –
現在的問題顯示'created_by'。 –
如果將'settings.AUTH_USER_MODEL'放在引號中會發生什麼?即'created_by = models.ForeignKey('settings.AUTH_USER_MODEL',unique = False) –