得到错误
CommandError: One or more models did not validate:
admin.logentry: 'user' has a relation with model su.SuUser, which has either not been installed or is abstract.`
当我跑步时python manage.py test
。
su 是我的用户应用程序,而应用程序是完成大部分工作的地方。
设置.py
INSTALLED_APPS = (
...
"su",
"app",
)
AUTH_USER_MODEL = 'su.SuUser'
苏/models.py
class SuUser(AbstractBaseUser, PermissionsMixin):
username = models.CharField(_('User name'), max_length=254, unique=True, db_index=True)
...
class Meta:
app_label = 'su'
应用程序/tests.py
from django_nose import FastFixtureTestCase as TestCase
from nose.tools import assert_equals
from django.contrib.auth import get_user_model
from django.test.utils import override_settings
User = get_user_model()
@override_settings(AUTH_USER_MODEL='su.SuUser')
class TestApp(TestCase):
...
任何想法?syncdb
工作正常。运行应用程序工作正常。
编辑 1
即使我尝试跳过自定义用户,例如
@skipIfCustomUser
class TestApp(TestCase):
...
仍然得到相同的错误。