Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django admin - show all for more than 200 items

Tags:

django

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?

like image 970
Thordin9 Avatar asked Jan 04 '11 11:01

Thordin9


People also ask

Can we customize Django admin panel?

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.

What is Fieldsets in Django admin?

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.)

Is Django admin good?

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.


1 Answers

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.

like image 105
Seppo Erviälä Avatar answered Sep 27 '22 18:09

Seppo Erviälä