5

我最近安装了 Blogango,出现以下错误:

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.

所以我添加了 settings.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)

我能做些什么来解决这个问题?

4

1 回答 1

2

似乎 Blogango(它是https://github.com/agiliq/django-blogango吗?)不支持Django 1.5 中引入的自定义用户模型。

Blogango 中的补丁应该很简单,只需替换:

from django.contrib.auth.models import User

和:

from django.contrib.auth import get_user_model
User = get_user_model()

django-blogango/blogango/models.py.

于 2013-12-16T19:42:01.520 回答