KeyError at /messages/inbox/ 'request'

Issue #91 closed
Anonymous created an issue

Hi, I'm happy user of your excellent app for years. Today I tried to add pagination, so I installed django-pagination and added pagination into settings before postman. However I get this error:

KeyError at /messages/inbox/
'request'

Here is the trackback:

    Request Method: GET
    Request URL: http://127.0.0.1:8000/messages/inbox/

    Django Version: 1.8.3
    Python Version: 2.7.12
    Installed Applications:
    ('django.contrib.admin',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.humanize',
     'django.contrib.sitemaps',
     'registration',
     'article',
     'photo',
     'contact',
     'captcha',
     'pure_pagination',
     'emoticons',
     'debug_toolbar',
     'django_markdown',
     'userprofile',
     'userpics',
     'pagination',
     'postman',
     'taggit',
     'taggit_templatetags',
     'axes',
     'redis',
     'simplemathcaptcha',
     'poll')
    Installed Middleware:
    (u'debug_toolbar.middleware.DebugToolbarMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'userprofile.middleware.ActiveUserMiddleware',
     'django.middleware.cache.FetchFromCacheMiddleware',
     'axes.middleware.FailedLoginMiddleware',
     'django.middleware.security.SecurityMiddleware')


    Template error:
    In template /home/pc/sai/postman/templates/postman/base_folder.html, error at line 38
       request

       28 :           </li>



       29 :           <li>



       30 :             <a href="/messages/settings">Settings</a>



       31 :           </li>



       32 :         </ul>



       33 :               </div>



       34 :         <div class="col-sm-6">



       35 :           <h3>{% block pm_folder_title %}{% endblock %}</h3>



       36 :         </div>



       37 : 



       38 :        {% autopaginate pm_messages %} 



       39 :       {% if invalid_page %}



       40 :       <p>Wrong page number</p>



       41 :       {% else %}



       42 :       {% if pm_messages %}



       43 :       {% block pm_by_modes %}<div id="pm_by_modes">



       44 :       <span class="pm_by_mode">{% if by_message %}<a href="{{ by_conversation_url }}">



       45 :        {% endif %}With conversation{% if by_message %}</a>{% endif %}



       46 : 



       47 :        <span class="pm_by_mode">



       48 :          {% if by_conversation %}<a href="{{ by_message_url }}">{% endif %}With message{% if by_conversation %}</a>{% endif %}


    Traceback:
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
      164.                 response = response.render()
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/response.py" in render
      158.             self.content = self.rendered_content
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/response.py" in rendered_content
      135.         content = template.render(context, self._request)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/backends/django.py" in render
      74.         return self.template.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/base.py" in render
      209.                     return self._render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
      96.     return self.nodelist.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/base.py" in render
      903.                 bit = self.render_node(node, context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
      79.             return node.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      135.         return compiled_parent._render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
      96.     return self.nodelist.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/base.py" in render
      903.                 bit = self.render_node(node, context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
      79.             return node.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      135.         return compiled_parent._render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
      96.     return self.nodelist.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/base.py" in render
      903.                 bit = self.render_node(node, context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
      79.             return node.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      135.         return compiled_parent._render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
      96.     return self.nodelist.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/base.py" in render
      903.                 bit = self.render_node(node, context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
      79.             return node.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
      65.                 result = block.nodelist.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/base.py" in render
      903.                 bit = self.render_node(node, context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
      79.             return node.render(context)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/pagination/templatetags/pagination_tags.py" in render
      91.             page_obj = paginator.page(context['request'].page)
    File "/home/pc/.newenv/local/lib/python2.7/site-packages/django/template/context.py" in __getitem__
      71.         raise KeyError(key)

    Exception Type: KeyError at /messages/inbox/
    Exception Value: 'request'

I also rename pagination_tags.py and removed pagination_tags.pyc. But did not solve the issue.

So I'm left in dark. Appreciate your help.

Comments (3)

  1. Log in to comment