N
N
nurzhannogerbek2018-02-01 16:08:56
Django
nurzhannogerbek, 2018-02-01 16:08:56

How to fix scrolling error in django-el-pagination app?

Hello, help me solve the problem.
I'm using infinite scroll in django-el-pagination app .
When the user reaches the last page in the terminal, an error appears:

Time: [25/Jan/2018 08:37:38] | LevelName: DEBUG | Module: base | Process: 1148 | Thread: 123145435922432 | Message: Exception while resolving variable 'querystring' in template 'documents/documents.html'.
Traceback (most recent call last):
  File "/Users/nurzhan_nogerbek/Virtualenvs/py2714/lib/python2.7/site-packages/django/template/base.py", line 903, in _resolve_lookup
    (bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [querystring] in u"[{'False': False, 'None': None, 'True': True}, {'csrf_token': <SimpleLazyObject: <function _get_val at 0x109034ed8>>}]

views.py:
from el_pagination.views import AjaxListView

class DocumentListView(AjaxListView):
    context_object_name = 'documents'
    template_name = "documents/main.html"
    page_template = 'documents/documents.html'

    def get_queryset(self):
        documents = Document.objects.all()
        return documents

documents/main.html:
<div class="list-group">
    {% include page_template %}
</div>

documents/documents.html:
{% load el_pagination_tags %}

{% paginate 20 documents %}
{% for document in documents %}
    {% include "documents/list_template.html" %}
{% endfor %}
{% show_more %}

documents/list_template.html:
<div class="list-group-item">{{document.title}}</div>

It seems to be an error due to the querystring that is used in the show_more tag template . Do you have any ideas how to fix this error?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question