Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heavy widgets iterate over the whole database table #54

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

Heavy widgets iterate over the whole database table #54

adamJLev opened this issue Sep 16, 2013 · 3 comments

Comments

@adamJLev
Copy link

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
Copy link
Owner

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

@applegrew
Copy link
Owner

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

@adamJLev
Copy link
Author

Works great now, thanks! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants