Skip to content

Commit

Permalink
Added disable pagination chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
shabda committed Feb 19, 2018
1 parent 6d895a8 commit 4910f12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions docs/disable_pagination.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
How to disable django admin pagination?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

If you want to completely disable pagination on a admin listview page, you can do this. ::


import sys
...

@admin.register(Hero)
class HeroAdmin(admin.ModelAdmin, ExportCsvMixin):
...

list_per_page = sys.maxsize

You can also read :doc:`increase_row_count`.
3 changes: 2 additions & 1 deletion heroes_and_monsters/entities/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .models import Hero, Villain, Category, Origin

import csv
import sys
from django.http import HttpResponse


Expand Down Expand Up @@ -52,7 +53,7 @@ class HeroAdmin(admin.ModelAdmin, ExportCsvMixin):
list_filter = ("is_immortal", "category", "origin", IsVeryBenevolentFilter)
actions = ["mark_immortal"]

list_per_page = 1
list_per_page = sys.maxsize

def mark_immortal(self, request, queryset):
queryset.update(is_immortal=True)
Expand Down

0 comments on commit 4910f12

Please sign in to comment.