社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  问与答

菜鸟贴 django-pagination 怎么用啊 总报request的错

msliudongsheng • 10 年前 • 7092 次点击  
Template error:
In template F:\django\panginationtest\panginationtest\templates\templates_pg.html, error at line 6
   request
   1 : <html>


   2 :     <body>


   3 :         <div>lds</div>


   4 :         <div>


   5 :         {% load pagination_tags %}


   6 :          {% autopaginate topics %}


   7 :         {% paginate %}


   8 : </div>


   9 :     </body>


   10 : </html>


   11 :

Traceback:
File "E:\python\lib\site-packages\django\core\handlers\base.py" in get_response
  114.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "F:\django\panginationtest\panginationtest\views.py" in listing
  7.     return render_to_response('templates_pg.html', {"topics": topics})
File "E:\python\lib\site-packages\django\shortcuts\__init__.py" in render_to_response
  29.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "E:\python\lib\site-packages\django\template\loader.py" in render_to_string
  164.         return t.render(Context(dictionary))
File "E:\python\lib\site-packages\django\template\base.py" in render
  140.             return self._render(context)
File "E:\python\lib\site-packages\django\template\base.py" in _render
  134.         return self.nodelist.render(context)
File "E:\python\lib\site-packages\django\template\base.py" in render
  840.                 bit = self.render_node(node, context)
File "E:\python\lib\site-packages\django\template\debug.py" in render_node
  78.             return node.render(context)
File "E:\python\lib\site-packages\django_pagination-1.0.7-py2.7.egg\pagination\templatetags\pagination_tags.py" in render
  91.             page_obj = paginator.page(context['request'].page)
File "E:\python\lib\site-packages\django\template\context.py" in __getitem__
  56.         raise KeyError(key)

Exception Type: KeyError at /pagination/
Exception Value: 'request'
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/501
 
7092 次点击  
文章 [ 4 ]  |  最新文章 10 年前