2đź‘Ť
After a very long time I have been able to find out the error I was having with django-pagination
. I had the canonical base template which I was extending on all pages.
In the documentation it is written that we require to put {% paginate %}
after {% autopaginate object_list %}
but no where it was written about the placement of {% autopaginate object_list %}
itself.
I had title
and body
blocks in my template, and I was putting {% autopaginate object_list %}
just below the {% extends "base.html" %}
and as a result it was not working. I found that I had to put this statement inside the body block
and now it is working absolutely fine.
0đź‘Ť
Can you see the content of your pagination div if you write “Hello, I want a burger” or anything else in there?
Are you sure you have enough Questions to paginate? You could try something like:
{% autopaginate Questions 2 %}
to make sure that you’ll be paginating at 2 questions/page.
- [Answered ]-Triggering Custom Functionality in Django Admin
- [Answered ]-Graphene-django – How to catch response of query?
- [Answered ]-Django templates whitespaces ans empty characters in for loop
- [Answered ]-CStringIO.StringIO() is not working
0đź‘Ť
Solved as Sachin told above:
I just moved {% load pagination_tags %}{% autopaginate list_objs 10 %}
inside {% block content %} statement (previously it was outside of it, so pagination was invisible. If no errors, but now pages – try to play with it (moving pagination block).
- [Answered ]-Django Sessions not Working
- [Answered ]-How to remove whitespaces in django urls?
- [Answered ]-Django return different class-based view according to whether an object has been created
- [Answered ]-Custom Django Authentication
- [Answered ]-Proper way to update model in Django