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
47
votes
9 answers

Display only some of the page numbers by django pagination

I am using the django paginator in the template. Its working ok, but not good when there's large numbers of pages. views.py: def blog(request): blogs_list = Blog.objects.all() paginator = Paginator(blogs_list, 1) try: page =…
Robin
  • 5,366
  • 17
  • 57
  • 87
21
votes
3 answers

Paginate relationship in Django REST Framework?

We are using Django REST Framework for our API and we have a need to paginate relationship fields that return multiple items. To demonstrate using examples similar to those in the documentation: class TrackSerializer(serializers.ModelSerializer): …
20
votes
4 answers

Pagination in Django-Rest-Framework using API-View

I currently have an API view setup as follows: class CartView(APIView): authentication_classes = [SessionAuthentication, TokenAuthentication] permission_classes = [IsAuthenticated, ] api_view = ['GET', 'POST'] def get(self, request,…
apatel
  • 611
  • 1
  • 6
  • 16
19
votes
3 answers

How to show more than 100 items on each paginated "Change List" page in Django Admin?

In one of the models overview panel, after I filter the items by month, I have to select them all and then create a document with information regarding them (kind of like a monthly report). This is a problem when one month has more than 100 items as…
yoshi
  • 191
  • 1
  • 1
  • 3
18
votes
4 answers

How to paginate "Change List" page in Django admin?

With my admin.py below, all items are shown on only one Change List page in Django admin: admin.py: from cliente.models import Cliente from django.contrib import admin class ClienteAdmin(admin.ModelAdmin): list_display =…
user614778
  • 547
  • 2
  • 5
  • 14
18
votes
3 answers

Django Rest Framework 3.1 breaks pagination.PaginationSerializer

I just updated to Django Rest Framework 3.1 and it seems that all hell broke loose. in my serializers.py I was having the following code: class TaskSerializer(serializers.ModelSerializer): class Meta: model = task exclude = ('key',…
stratis
  • 7,750
  • 13
  • 53
  • 94
15
votes
4 answers

Django pagination...slicing pages to show fraction of total pages?

I have the pagination module working for the most part but there's one issue. How can I only show a slice of the total available pages. For example, let's say I'm on page 5 of n pages, I'd want to show. 1,2,3,4,5,6....(n-1)(n). I believe that…
Ben
  • 15,010
  • 11
  • 58
  • 90
14
votes
4 answers

How to show the correct object numbers when using django-pagination

I am using django-pagination to paginate my object list. It is working flawlessly. I want to give a number to each object on the page and I am using {{forloop.counter}} for that, but the problem is it starts the object count from 1 on each page. I…
Sachin
  • 3,672
  • 9
  • 55
  • 96
13
votes
3 answers

"Show all" for more than 200 items in Django Admin

I currently have a listing in django admin that is split across 8 pages. What I need to do is to have a button/link to display all items of a list in django admin even if there are more than 200 items while keeping the pagination. Show all link does…
Thordin9
  • 379
  • 1
  • 4
  • 14
12
votes
3 answers

django pagination and RawQuerySet

is there a way to paginate a rawqueryset using django's inbuilt pagination? when i cast it to a list , it throws an error in my face ...TypeError: expected string or Unicode object, NoneType found. Is there a way around this?
mossplix
  • 3,783
  • 2
  • 26
  • 31
11
votes
2 answers

Django Pagination Display Issue: all the page numbers show up

is there any way to make page display of django pagination better? I followed the [doc][1] to create it, but hoping there is simple way to organize page number display. Currently, it shows all the pages, say I have 10 pages, then prev 1 2 3 4 5 6 7…
DavidL
  • 1,260
  • 2
  • 17
  • 35
11
votes
4 answers

Django Pagination

I need to make real pagination instead of paginating on all retreived data. The example in Django documentation site, is like; def listing(request): contact_list = Contacts.objects.all() paginator = Paginator(contact_list, 25) # Show 25…
Ahmet DAL
  • 4,445
  • 9
  • 47
  • 71
10
votes
3 answers

Infinite scroll in django

Is it possible to implement facebook style loading of content while scrolling down? I would like to implement it in an ecommerce site. There are a lot of items in each category and the category page becomes too long. I could implement page numbers…
user1077344
9
votes
3 answers

Django paginator page range for not displaying all numbers

I have a pagination in my site but it shows me every page like 1-19, i only want to display only 5 pages. How can i do this? views.py paginator = Paginator(object_list, new_number_of_list) page = request.GET.get('page') try: …
I.Jokhadze
  • 456
  • 2
  • 8
  • 27
8
votes
3 answers

How can I split DataFrame (pandas) on pages with django paginator?

It is easy for Series. I just pass it to paginator. But, when I use DataFrame, it is call "The truth value of a Series is ambiguous". Maybe, there are problem with count method, but I don't know how I can change it. In my project DataFrame must be…
MrFairWall
  • 158
  • 1
  • 2
  • 10
1
2 3
19 20