我正在尝试创建一个UserFactory
,运行时出现此错误./manage.py test
:
OperationalError: no such table: auth_user
这是我的factories.py
文件的样子:
import factory
import django.contrib.auth.models as auth_models
from wacep.weatherroulette.models import (
GameState, Puzzle
)
class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = auth_models.User
username = factory.Sequence(lambda n: "user_%d" % n)
class PuzzleFactory(factory.django.DjangoModelFactory):
class Meta:
model = Puzzle
display_name = factory.Sequence(lambda n: 'Test Puzzle {0}'.format(n))
description = factory.Sequence(lambda n: 'Description {0}'.format(n))
class GameStateFactory(factory.django.DjangoModelFactory):
class Meta:
model = GameState
user = UserFactory()
current_inventory = 300
有人知道这里发生了什么吗?