Heavy widgets iterate over the whole database table #54

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

Comments

Projects
None yet
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

This comment has been minimized.

Show comment
Hide comment
@applegrew

applegrew Sep 16, 2013

Owner

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

Owner

applegrew commented Sep 16, 2013

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

@applegrew

This comment has been minimized.

Show comment
Hide comment
@applegrew

applegrew Sep 17, 2013

Owner

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

Owner

applegrew commented Sep 17, 2013

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

@adamJLev

This comment has been minimized.

Show comment
Hide comment
@adamJLev

adamJLev Sep 17, 2013

Works great now, thanks! 🍻

Works great now, thanks! 🍻

@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