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.
the "show all" link does exactly what i need but its limited to 200 items. Is there any way i can change that? (without modifying the core). Also is there a way so i can change the list_per_page in the modeladmin on demand?
We have a lot of tools in Django to customize it to our own needs and in this article, we'll learn how to customize the admin interface and add multiple features: Let's setup your project, add models into models.py and register your models.
Set fieldsets to control the layout of admin “add” and “change” pages. fieldsets is a list of two-tuples, in which each two-tuple represents a <fieldset> on the admin form page. (A <fieldset> is a “section” of the form.)
Django provides a good authentication framework with tight integration to Django admin. Out of the box, Django admin does not enforce special restrictions on the user admin. This can lead to dangerous scenarios that might compromise your system.
You can change the list_max_show_all
and list_per_page
attributes on your admin class.
class FooAdmin(admin.ModelAdmin):
list_max_show_all = 500
list_per_page = 200
Works with Django 1.4 and newer. See the manual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With