TypeError: 'buildid' is an invalid keyword argument for this function
使用django 保存对象的时候,报了如下错误,大概意思是字段是无效的:
Traceback (most recent call last): File "/Users/panjing/dev/qikenet/qikenet/tests.py", line 67, in test_firmware signed=f['signed'] File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/query.py", line 411, in create obj = self.model(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/models/base.py", line 485, in __init__ raise TypeError("'%s' is an invalid keyword argument for this function" % kwarg) TypeError: 'buildid' is an invalid keyword argument for this function ----------------------------------------------------------------------
以为是字段没有加上去,然后排查模型
有这个字段,然后排查数据库
用迁移命令重新生成
python3 manage.py makemigrations No changes detected
检测不到这个字段,只能手动去加一下了,或者删除django的迁移日志,整个表重新生成。
迁移日志在django_migrations表中。