都是has no field name最后一个class名,然后错误文件都是指向同一个文件\Python\Python36\lib\site-packages\django\db\models\options.py in get_field, line 568。都是这一行。
错误信息:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/xadmin/courses/courseresource/
Django Version: 2.0.1
Python Version: 3.6.4
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
'courses',
'organization',
'operation',
'xadmin',
'crispy_forms']
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\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\options.py" in get_field
566. return self.fields_map[field_name]
During handling of the above exception ('course'), another exception occurred:
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py" in inner
35. response = get_response(request)
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\sites.py" in wrapper
300. return self.admin_view(view, cacheable)(*args, **kwargs)
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\sites.py" in inner
208. return view(request, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in view
282. return handler(request, *args, **kwargs)
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in _wrapper
62. return bound_func(*args, **kwargs)
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in bound_func
58. return func.__get__(self, type(self))(*args2, **kwargs2)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in method
80. return filter_chain(filters, len(filters) - 1, _inner_method, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in filter_chain
49. return func()
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in _inner_method
74. return func(self, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\list.py" in get
402. response = self.get_result_list()
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in method
80. return filter_chain(filters, len(filters) - 1, _inner_method, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in filter_chain
49. return func()
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in _inner_method
74. return func(self, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\list.py" in get_result_list
201. return self.make_result_list()
File "C:\imooc\MxOnline\extra_apps\xadmin\views\list.py" in make_result_list
173. self.list_queryset = self.get_list_queryset()
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in method
80. return filter_chain(filters, len(filters) - 1, _inner_method, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in filter_chain
63. return filter_chain(filters, token - 1, _inner_method, *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in filter_chain
49. return func()
File "C:\imooc\MxOnline\extra_apps\xadmin\views\base.py" in _inner_method
62. return fm(func if fargs[1] == '__' else func(), *args, **kwargs)
File "C:\imooc\MxOnline\extra_apps\xadmin\plugins\filters.py" in get_list_queryset
120. self.model, field_path)
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\utils.py" in get_fields_from_path
490. fields.append(parent._meta.get_field(piece))
File "C:\Users\16174\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\options.py" in get_field
568. raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
Exception Type: FieldDoesNotExist at /xadmin/courses/courseresource/
Exception Value: CourseResource has no field named 'course'
_遥不可及_
奔跑的小码农
相关分类