Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix problems with querystring in show_more tag? #101

Open
nurzhannogerbek opened this issue Jan 25, 2018 · 4 comments
Open

How to fix problems with querystring in show_more tag? #101

nurzhannogerbek opened this issue Jan 25, 2018 · 4 comments

Comments

@nurzhannogerbek
Copy link

nurzhannogerbek commented Jan 25, 2018

Hello! :) First of all THANK YOU for this wonderful project!

I use pagination on scroll in my own project. It works great but has some strange thing. When user scroll to the last page in terminal I notice this Traceback. It seems to me that something wrong with
querystring which we use in show_more tag. Do you have any ideas how to fix it?!

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>>}]"

documents/main.html:
{% include page_template %}

documents/documents.html: <-- It's page_template

{% load el_pagination_tags %}

{% paginate 20 documents %}
{% for document in documents %}
	{% include "documents/list_template.html" %}
{% endfor %}
{% show_more %}
@shtalinberg
Copy link
Owner

Can you show more details ?

@nurzhannogerbek
Copy link
Author

Hello, @shtalinberg :) As I said this Traceback happens only when user scroll to the last page. Lets say I have 5 page, so this Traceback happens only when user at last page: http://127.0.0.1:8000/documents/?page=5&querystring_key=page

Well, here is my views.py file:

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

urls.py file looks like this:

url(r'^documents/',
    DocumentListView.as_view(),
    name='document_list'),

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>

Do you have any ideas whats wrong with querystring in last page?

@shtalinberg
Copy link
Owner

which version el_pagination and Django are used?

@nurzhannogerbek
Copy link
Author

I use django==1.11.5 and django-el-pagination==3.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants