Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#27774 closed Uncategorized (invalid)

django admin with many objects count is very slow

Reported by: Sayid Munawar Owned by: nobody
Component: contrib.admin Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes


Django version 1.11a1

i created many (thousands) objects:

...: count = 500
...: for x in range(0, count):
...:     print(Group.objects.create(name=usr()))

In [10]: Group.objects.count()
Out[10]: 4265

Then go to Admin->Groups, and click one of them. The page will be rendered very slow compared to django 1.10. See screenshots:

Django 1.10

Django 1.11a

Django 2.0-dev

Change History (6)

comment:1 Changed 6 years ago by Tim Graham

That might be due to template-based widget rendering (#15667). Can you bisect to find the commit where the behavior changed?

comment:2 Changed 6 years ago by Sayid Munawar

Hi Tim, i don't know how to write a test for this case. i just using git prev / next around commits in that ticket. And i found this commit

commit b52c73008a9d67e9ddbb841872dc15cdd3d6ee01
Author: Preston Timmons <>
Date:   Tue Dec 27 17:00:56 2016 -0500

    Fixed #15667 -- Added template-based widget rendering.

will make the render slow. on the commit before that (51cde87... Fixed #27648 -- Deprecated (iLmsu) regex groups in url() patterns) the render still very fast. I know there should be more processing from template based widget rendering. but this is just too much

In another test with django-treebeard admin page, the amount of time to render its admin page is 30 seconds. it's just unacceptable

comment:3 Changed 6 years ago by Claude Paroz

Does using the cached template loader ( make a big difference here?

comment:4 Changed 6 years ago by Sayid Munawar

Hi Claude Paroz, the django template cached loader makes no big difference. still around 2 seconds to render a page. In my admin page which render admin page for django-treebeard, the cached loader makes no difference too. Maybe there is another issue from django-treebeard, idk. one thing for sure is that it was fine when using django 1.10, though it will take seconds to render a tree (django-treebeard, MP_Node) from thousands objects. But when using django 1.11alpha, the page is loading forever, no response.

comment:5 Changed 6 years ago by Tim Graham

Resolution: invalid
Status: newclosed

This isn't an issue in Django but rather caused if the Templates panel in the debug toolbar is enabled. I've filed an issue in its issue tracker.

comment:6 Changed 6 years ago by Sayid Munawar

disabling template analysis panel in django-debug-toolbar make my admin page fast again. sorry didn't try that before

Note: See TracTickets for help on using tickets.
Back to Top