How do I disable django admin markup?

I need to disable django admin pagination pagination. I am using mttp in django and I need to disable pagination in some admin module.

How can i do this?
Or how can I make the parent-only pagination?

+3


source to share


3 answers


If you are using Django 1.8 (newest) show_full_result_count

there is a new setting in the ModelAdmin class named there which I believe will do what you are looking for. You can set it to false and it will disable pagination in the Django admin view.



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

-3


source


The number of elements per page is determined ModelAdmin.list_per_page

.

As @codingjoe's comment suggests setting will sys.maxsize

probably be enough.



import sys

class PartAdmin(admin.ModelAdmin):
    list_per_page = sys.maxsize

      

@SpiRail's answer is around the corner, but it is not correct to query the DB during module import. It is also list_max_show_all

not required because there will be no show all link when all items are already shown.

0


source


I do this 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 the maximum number on the page.

-2


source







All Articles