Questions tagged [django-pagination]

Django-pagination refers to the Django (a Python-based and open-source web framework) way of managing data split across several pages, with "Previous/Next" links. Use this tag for questions related to classes related to pagination in Django.

Django-pagination refers to the Django (a Python-based and open-source web framework) way of managing data split across several pages, with "Previous/Next" links. Use this tag for questions related to classes related to pagination in Django.

300 questions
2
votes
2 answers

How can I improve pagination performance in multiple queryset django?

I have 2 queryset : queryset_primary = PrimaryUserSerializer(FileUpload.objects.all().order_by('name'), many=True, context=context).data queryset_secondary = MemberSerializer(Members.objects.all().order_by('member_name'), many=True,…
2
votes
2 answers

Django PageNumberPagination customize error if page number out of range

I'm currently trying to create an API that return list of objects with page and limit per page input from url parameter using django-rest-framework which i already done in my api view with custom Pagination class…
2
votes
1 answer

Django pagination is not working properly with very large dataset

When I use pagination with a very large dataset, it works too slow. Maybe I am not implementing it properly. Please help. How to make it fast? Is there anything that I can change or implement so that it works fine? view.py def display(request): …
user10989738
  • 81
  • 1
  • 11
2
votes
1 answer

How to perform pagination for context object in django?

I have tried something like this in views.py: class HomePage(TemplateView): template_name = "clouderp/index.html" def get_context_data(self, **kwargs): context = super(HomePage, self).get_context_data(**kwargs) qs =…
Niladry Kar
  • 1,163
  • 4
  • 20
  • 50
2
votes
1 answer

Django Viewset Pagination throws serialization error

I have something like this: Paginating Viewset: class FeedViewSet(ModelViewSet): queryset = Feed.objects.all() serializer_class = FeedSerializer def list(self, request, *args, **kwargs): paginator =…
2
votes
2 answers

Pagination problem with Django haystack

i'm using django-haystack with simple engine, the search is fine, but the pagination is not working. This is the code of my search results template {% if query %}
{% for result in page.object_list…
eos87
  • 8,961
  • 12
  • 49
  • 77
2
votes
2 answers

Pagination in Django not working as expected

I wanted pagination for all the courses available and that was easy to achieve. But now I'm stuck because I wanted pagination for faculties also, which will show specific courses of the accessed faculty. I have 4 models: faculties, departments,…
user9092892
2
votes
2 answers

How to add pagination to FilterView

I've filtering view of django_filters.FilterSet which is called right from urls.py url(r'^$', FilterView.as_view(filterset_class=ProductFilter, template_name='products/products.html'), name='products'), and it's has no pagination, but when i add…
Dmitrii
  • 604
  • 2
  • 9
  • 30
2
votes
1 answer

Optimizing pagination in function-based views (in Django)

In a class-based Django listview, when one allots a value to paginate_by, it ensures that the object_list available in get_context_data method is limited to only those objects that are needed for that particular page. E.g. get_queryset might return…
Hassan Baig
  • 15,055
  • 27
  • 102
  • 205
2
votes
1 answer

Django Paginate CPU Time scaling with number of selected objects not displayed objects

I have a simple database with about 3900 entries, and am using a generic view (django.views.generic.list_detail.object_list) with its django-pagination (through paginate_by) to browse the data in the database, but some queries are very slow. The…
dr jimbob
  • 17,259
  • 7
  • 59
  • 81
2
votes
3 answers

COUNT(id) instead of COUNT(*) in Django

I'm paginating a list view for a model with many fields, so it takes a lot of time to execute MyModel.objects.filter('some filter').count(), because on SQL level it runs SELECT COUNT(*) FROM mytable instead of: SELECT COUNT(id) FROM mytable even…
cansadadeserfeliz
  • 3,033
  • 5
  • 34
  • 50
2
votes
1 answer

django generic view pagination by item id (not page number)

I love the ease of django's pagination system, but is there anyway to tweak it where it's paginating by item id instead of page number? Because I am ordering in descending order, if there is an update on a page while a user is going through the…
killerbarney
  • 947
  • 10
  • 24
2
votes
4 answers

Object not iterable with django's pagination

I have a template showing a list of events. To prepare list of events I'm using generic views, and set 'paginate_by' parameter. Strangely when I load my page I see : TemplateSyntaxError at /event/latest/ Caught an exception while rendering: 'int'…
tom_pl
  • 425
  • 2
  • 9
  • 16
2
votes
1 answer

Django pagination: "show all" implementation

I have a page with a list of objects and two buttons: show more and show all. The objects are loaded by AJAX, sending to a ItemsListView a page number: class ItemsListView(ListView): paginate_by = 2 On initializing the page, JS variable…
cansadadeserfeliz
  • 3,033
  • 5
  • 34
  • 50
2
votes
2 answers

In Django-pagination Paginate does not working

Python 2.6.2 django-pagination 1.0.5 Question: How to force pagination work correctly? The problem is that {% paginate %} does not work, but other {% load pagination_tags %} and {% autopaginate object_list 10 %} works! Error message appeared,…
mosg
  • 12,041
  • 12
  • 65
  • 87