[Django] #21534: Admin List Widgets Need To Be Paginated

4 views
Skip to first unread message

Django

unread,
Nov 29, 2013, 3:51:49 PM11/29/13
to django-...@googlegroups.com
#21534: Admin List Widgets Need To Be Paginated
-------------------------+-------------------------------------------------
Reporter: | Owner: nobody
gabreyla@… | Status: new
Type: New | Version: 1.6
feature | Keywords: Admin, Lots of Data, Paginated
Component: | Widgets
contrib.admin | Has patch: 0
Severity: Normal | UI/UX: 1
Triage Stage: |
Unreviewed |
Easy pickings: 1 |
-------------------------+-------------------------------------------------
I connected the Django ORM to an existing postgresDB (which we used to use
sqlAlchemy to manage/use) and has a lot of data in it. Some tables have
upward of half a million rows.

The Django Admin works fine when listing the objects in a table (ei:
/admin/users) and it's quite snappy because it only displays 100 objects
at a time (the list view is paginated)

But then when I inspect one of the objects (ei: /admin/users/1) then a
very lengthy query starts to join and list all items in tables that have a
relationship with this object. This happens because some of the admin
widgets are not paginated and would want to display all .5 million objects
in that single widget. The query is usually too long and the request times
out. Usually it times out even earlier at around 100k rows. (1 foreignKey
relationship to a 100k table takes 512 seconds, verified using Django-
debug-toolbar)

It's quite insane for widget to display all of that info just as much as
it's crazy to expect the user to browse (by means of a scrollbar) 100k-1M
rows.

The current widgets used in the Admin are "good defaults" for small
tables, but *not* good defaults for the general case.

I think that a lot of pain could be avoided for a lot of people if the
default widgets used in the Admin were paginated as well just like the
list views of the Admin is.

--
Ticket URL: <https://code.djangoproject.com/ticket/21534>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 29, 2013, 3:53:26 PM11/29/13
to django-...@googlegroups.com
#21534: Admin List Widgets Need To Be Paginated
-------------------------------------+-------------------------------------
Reporter: gabreyla@… | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: Admin, Lots of | Triage Stage:
Data, Paginated Widgets | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by gabreyla@…):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/21534#comment:1>

Django

unread,
Nov 29, 2013, 4:35:38 PM11/29/13
to django-...@googlegroups.com
#21534: Admin List Widgets Need To Be Paginated
-------------------------------------+-------------------------------------
Reporter: gabreyla@… | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: Admin, Lots of | Triage Stage:
Data, Paginated Widgets | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by timo):

Have you tried
[https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields
raw_id_fields]?

--
Ticket URL: <https://code.djangoproject.com/ticket/21534#comment:2>

Django

unread,
Nov 29, 2013, 5:48:15 PM11/29/13
to django-...@googlegroups.com
#21534: Admin List Widgets Need To Be Paginated
-------------------------------------+-------------------------------------
Reporter: gabreyla@… | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: Admin, Lots of | Triage Stage:
Data, Paginated Widgets | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by gabreyla@…):

I haven't tried that yet actually. It's hardly ideal though. (only the IDs
are displayed and you can't browse to select other options)
Do you think it would be possible to replace the current list widget with
the corresponding admin list view for that object? So that for example if
you specify that the OrgAdmin has a search box on the field 'name', then
the 'detailed view Admin' for User will use the Admin list view of Orgs
with the search box as the widget to select the Org? (which also means
that by default is paginated) (Admin-ception style)

Thank you for replying and sharing!

--
Ticket URL: <https://code.djangoproject.com/ticket/21534#comment:3>

Django

unread,
Nov 29, 2013, 8:13:54 PM11/29/13
to django-...@googlegroups.com
#21534: Admin List Widgets Need To Be Paginated
-------------------------------------+-------------------------------------
Reporter: gabreyla@… | Owner: nobody
Type: New feature | Status: closed

Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: Admin, Lots of | worksforme
Data, Paginated Widgets | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => worksforme


Comment:

Actually, you can browse to select other options (click the magnifying
glass icon) and those results are paginated with a search box as you
describe. Please give it a try!

--
Ticket URL: <https://code.djangoproject.com/ticket/21534#comment:4>

Django

unread,
Dec 2, 2013, 1:58:30 PM12/2/13
to django-...@googlegroups.com
#21534: Admin List Widgets Need To Be Paginated
-------------------------------------+-------------------------------------
Reporter: gabreyla@… | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: Admin, Lots of | worksforme
Data, Paginated Widgets | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by gabreyla@…):

Thank you timo, your suggestion works quite well for IDs. Do you know if I
can use some other unique column instead of the primary key?

I agree this ticket is now closed

--
Ticket URL: <https://code.djangoproject.com/ticket/21534#comment:5>

Django

unread,
Dec 2, 2013, 3:47:34 PM12/2/13
to django-...@googlegroups.com
#21534: Admin List Widgets Need To Be Paginated
-------------------------------------+-------------------------------------
Reporter: gabreyla@… | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: Admin, Lots of | worksforme
Data, Paginated Widgets | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by timo):

No, I don't think so.

If you have further questions, see
[https://docs.djangoproject.com/en/dev/faq/help/ Getting Help] for some
better places to ask questions. We try to avoid using this ticket tracker
as a support channel, thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/21534#comment:6>

Reply all
Reply to author
Forward
0 new messages