status函数python_“status”是此函数的无效关键字参数

本文档记录了在使用Django 2.1.5和Python 3.7.2开发时遇到的问题,涉及consignment_status模型中的查询错误,指出'status'作为关键字参数时被误用,展示了如何解决此类型TypeError。
摘要由CSDN通过智能技术生成

Environment:

Django Version: 2.1.5 Python Version: 3.7.2 Installed Applications:

['django.contrib.admin', 'django.contrib.auth',

'django.contrib.contenttypes', 'django.contrib.sessions',

'django.contrib.messages', 'django.contrib.staticfiles',

'rest_framework', 'rest_framework.authtoken', 'phonenumber_field',

'user_accounts', 'shipments', 'CA', 'rest_auth',

'rest_auth.registration', 'allauth', 'allauth.account',

'django.contrib.sites', 'allauth.socialaccount', 'dashboard']

Installed Middleware:

['django.middleware.security.SecurityMiddleware',

'django.contrib.sessions.middleware.SessionMiddleware',

'django.middleware.common.CommonMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',

'django.contrib.auth.middleware.AuthenticationMiddleware',

'django.contrib.messages.middleware.MessageMiddleware',

'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\exception.py"

in inner

34. response = get_response(request)

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py"

in _get_response

126. response = self.process_exception_by_middleware(e, request)

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py"

in _get_response

124. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\decorators\csrf.py"

in wrapped_view

54. return view_func(*args, **kwargs)

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\views\generic\base.py"

in view

68. return self.dispatch(request, *args, **kwargs)

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py"

in dispatch

495. response = self.handle_exception(exc)

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py"

in handle_exception

455. self.raise_uncaught_exception(exc)

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py"

in dispatch

492. response = handler(request, *args, **kwargs)

File

"C:\Users\myfxhuta\Documents\Coding\python-testing\CA\dashboard\views.py"

in get

23. "data" : consignment_status.objects.with_counts()

File

"C:\Users\myfxhuta\Documents\Coding\python-testing\CA\dashboard\models.py"

in with_counts

22. p = self.model(consignmentNo=row[0], status=row1, created_time=row[2])

File

"C:\Users\myfxhuta\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\base.py"

in init

485. raise TypeError("'%s' is an invalid keyword argument for this function" % kwarg)

Exception Type: TypeError at /a/something Exception Value: 'status' is

an invalid keyword argument for this function

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值