使用 from django.contrib.auth.models import User 进行测试时出错

Error in test using from django.contrib.auth.models import User

我正在使用 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

我怀疑这个错误与用户有关。

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

class Employee(Person):
    ...