{"action":"opened","issue":{"url":"https://api.github.com/repos/divio/django-filer/issues/868","repository_url":"https://api.github.com/repos/divio/django-filer","labels_url":"https://api.github.com/repos/divio/django-filer/issues/868/labels{/name}","comments_url":"https://api.github.com/repos/divio/django-filer/issues/868/comments","events_url":"https://api.github.com/repos/divio/django-filer/issues/868/events","html_url":"https://github.com/divio/django-filer/issues/868","id":161964983,"number":868,"title":"Slow directory listing in admin for folder with lots of files","user":{"login":"plumdog","id":2348591,"avatar_url":"https://avatars.githubusercontent.com/u/2348591?v=3","gravatar_id":"","url":"https://api.github.com/users/plumdog","html_url":"https://github.com/plumdog","followers_url":"https://api.github.com/users/plumdog/followers","following_url":"https://api.github.com/users/plumdog/following{/other_user}","gists_url":"https://api.github.com/users/plumdog/gists{/gist_id}","starred_url":"https://api.github.com/users/plumdog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plumdog/subscriptions","organizations_url":"https://api.github.com/users/plumdog/orgs","repos_url":"https://api.github.com/users/plumdog/repos","events_url":"https://api.github.com/users/plumdog/events{/privacy}","received_events_url":"https://api.github.com/users/plumdog/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-23T16:22:24Z","updated_at":"2016-06-23T16:22:24Z","closed_at":null,"body":"I've run into a performance issue with the admin page when viewing a folder that contain lots of files (hundreds, but not thousands). It's fine if the current user is a super user, but for a non super it slows to a crawl, taking upwards of 30 seconds to load a page.\r\n\r\nI think I tracked this down to be caused by [this line](https://github.com/divio/django-filer/blob/1.2.0/filer/admin/folderadmin.py#L366), and I think the reason is that we are doing a permissions check for every item in the list, before we give it to the paginator. But all we actually want is to know if we should show the \"Change\" link in `directory_table.html`, based on `item_perms.change`, so we only need to do this check for each item we are showing on the page, which is just 20. The reason it is fast for a superuser is that they skip any permissions checking that hits the database.\r\n\r\nThis change could be done either in Python, but after the paginator has chopped up the list, or in the template. I'll have a play about with it and see where I get."}}
{"actor":{"display_login":"plumdog"}}