使用来自django.contrib.auth.models导入用户的测试错误

时间:2015-02-03 06:01:07

标签: django testing django-models tdd traceback

我正在使用django.contrib.auth并遇到以下错误:

Creating test database for alias 'default'...
...EE..
======================================================================
ERROR: test_create (new_way.core.tests.test_models.EmployeeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rg3915/git/my/new_way_project/new_way/core/tests/test_models.py", line 121, in setUp
    comission=180.5
  File "/home/rg3915/git/my/new_way_project/lib/python3.4/site-packages/django/db/models/base.py", line 452, in __init__
    raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'birthday' is an invalid keyword argument for this function

======================================================================
ERROR: test_has_created_at (new_way.core.tests.test_models.EmployeeTest)
Employee must have automatic created_at
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rg3915/git/my/new_way_project/new_way/core/tests/test_models.py", line 121, in setUp
    comission=180.5
  File "/home/rg3915/git/my/new_way_project/lib/python3.4/site-packages/django/db/models/base.py", line 452, in __init__
    raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'birthday' is an invalid keyword argument for this function

----------------------------------------------------------------------
Ran 7 tests in 0.010s

FAILED (errors=2)
Destroying test database for alias 'default'...

查看我的模特。

https://gist.github.com/rg3915/1f8094c5e3626ae56386

我怀疑此错误与用户有关。

1 个答案:

答案 0 :(得分:2)

据我了解,您打算让Employee模型基于Person抽象模型,而不是基于UserProfile

class Employee(Person):
    ...
相关问题