|Admin widget for filter_vertical and filter_horizontal slow||maco||4/16/09 1:40 AM|
My model has two Foreign Keys. Each FK has 4000 entries or more. In
admin.py I use filter_horizontal for those FK.
I noticed that JS widget is slow both on first render of admin page
(add item) and on every selection of an FK item inside the widget. I
takes 5 seconds AFTER admin page already loads for JS to render
widget. In this time browser is unresponsive. Selection of an item
takes even longer.
I've tested this on various browsers and systems.
I'm am fairly confident that the number of FK items is a major factor
in slowing down the render of the widget because I tried deleting FK
items and browser was starting to show improvements in speed. When the
number of FK items dropped under 1000 admin site become much faster
(and actually usable).
I've also completely removed filter_horizontal just to be sure nothing
is wrong with admin on a general and all seemed good and super fast.
So, I recon, some revision of JS for filter in admin is needed or sth.
Thanks for any thoughts on that.
|Re: Admin widget for filter_vertical and filter_horizontal slow||Christopher Dodd||4/16/09 8:01 AM|
Yeah, this is a known issue. http://code.djangoproject.com/ticket/3202
I ran into it myself and have been trying all kinds of things to work
Once you get enough rows in a table the default controls are no longer
Have you looked into the raw_id_fields option? It wasn't an option for
me but it might help you.
|Re: Admin widget for filter_vertical and filter_horizontal slow||maco||4/17/09 1:01 AM|
Thanks, that's a nice workaround. I'll give it a thought. Having a
input filed widget instead of select plus some JS for suggested
search. I use jquery.liveSearch.js allready on a title in my model.
On 16 apr., 17:01, Christopher Dodd <dodd.ch...@gmail.com> wrote:
> Yeah, this is a known issue.http://code.djangoproject.com/ticket/3202
> I ran into it myself and have been trying all kinds of things to work> me but it might help you.http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-op...