在网站实例中点击By发布年份下2019年的链接,CMD命令行屏幕显示错误代码:
[08/Mar/2022 17:13:47] "GET /admin/article/article/ HTTP/1.1" 200 10201
Internal Server Error: /admin/article/article/
Traceback (most recent call last):
File "F:\python\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "F:\python\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "F:\python\lib\site-packages\django\contrib\admin\options.py", line 622, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "F:\python\lib\site-packages\django\utils\decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "F:\python\lib\site-packages\django\views\decorators\cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "F:\python\lib\site-packages\django\contrib\admin\sites.py", line 236, in inner
return view(request, *args, **kwargs)
File "F:\python\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "F:\python\lib\site-packages\django\utils\decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "F:\python\lib\site-packages\django\contrib\admin\options.py", line 1710, in changelist_view
cl = self.get_changelist_instance(request)
File "F:\python\lib\site-packages\django\contrib\admin\options.py", line 742, in get_changelist_instance
return ChangeList(
File "F:\python\lib\site-packages\django\contrib\admin\views\main.py", line 100, in __init__
self.queryset = self.get_queryset(request)
File "F:\python\lib\site-packages\django\contrib\admin\views\main.py", line 464, in get_queryset
new_qs = filter_spec.queryset(request, qs)
File "F:\blog\article\admin.py", line 36, in queryset
return queryset.filter(publish_date__gte=date(2019, 1, 1),
NameError: name 'date' is not defined