Skip to content

Heavy widgets iterate over the whole database table #54

Closed
adamJLev opened this Issue Sep 16, 2013 · 3 comments

2 participants

@adamJLev

When there's an initial value (e.g. in an admin edit page), HeavySelect2Mixin.render_texts gets called which causes the whole dataset to be iterated. This basically makes this nifty library useless when dealing with big tables.

In this line self.choices is a lazy representation of all possible choices, and accessing it triggers a SQL query without LIMIT.
https://github.com/applegrew/django-select2/blob/master/django_select2/widgets.py#L414

I tried to take a stab at it but no luck, not sure where to start fixing this issue.
Any pointers? Thanks!

@applegrew
Owner

I have had this issue reported before too but nobody was able to mention this so clearly. I will check this.

@applegrew
Owner

Please download the latest Master code and let me know if you can replicate the issue anymore.

@adamJLev

Works great now, thanks! :beers:

@applegrew applegrew closed this Sep 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.