5

I need turn off django admin pagination. I use mttp in django and I need disable pagination on some admin module.

How I can do it?
Or how I can make pagination only by parents?

Anthon
  • 69,918
  • 32
  • 186
  • 246

3 Answers3

1

The number of items per page is determined by ModelAdmin.list_per_page.

As @codingjoe's comment suggests, setting this to sys.maxsize is very likely to suffice.

import sys

class PartAdmin(admin.ModelAdmin):
    list_per_page = sys.maxsize
meshy
  • 8,470
  • 9
  • 51
  • 73
-3

If you're using Django 1.8 (the newest version), there is a new setting on the ModelAdmin class called show_full_result_count that I believe will do what you're looking for. You can set it to false and it will disable the pagination on the Django admin view.

Reference: https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.show_full_result_count

samskeller
  • 114
  • 1
  • 5
  • No, I'm using Django 1.7 – Никстер Apr 20 '15 at 04:29
  • There are some hacky solutions for non-1.8 -- you can see the discussion on the issue here: https://code.djangoproject.com/ticket/4065 – samskeller Apr 20 '15 at 04:32
  • 3
    This wont disable pagination. It will just remove the indication of the total number of entries in the table, which requires an extra query and can slow down the whole page. – Weier May 22 '15 at 20:46
  • 1
    `show_full_result_count` does not disable pagination as Weier mentioned – dhui Aug 07 '15 at 05:51
-3

I do this in order to put everything on one page:

class PartAdmin(admin.ModelAdmin):
    list_per_page = Part.objects.all().count()
    list_max_show_all = list_per_page

It just counts all the parts (my model is called "Part") and then makes that the max number per page.

SpiRail
  • 1,377
  • 19
  • 28