I haven't looked into the problem in detail, but it doesn't surprise me that it exists.
It's also probable that it's something that is new to 1.4 (or, at least, that it manifests in slightly different ways in 1.4). One of the features added in 1.4 is bulk insertion of data. This means that you can use a single SQL statement to insert all your m2m relation; however, the downside is that on SQLite, there is a limit of 500 insertions that can be done at any one time (2 values per insertion).
This is logged as ticket #17788. There have been some discussions about a fix for this problem that will break the bulk insertion into batches. I suspect that when this problem is fixed, your problem will go away.
That said, I would also suggest you have a think about how you represent this widget in your UI. The approach you're describing is going to be very slow for the end user -- every time they load the page, they're going to have to download the HTML for a widget 1000 choices; when they send their selections, they're going to have to POST up to 1000 choices back to the server. This all takes time, and won't result in a particularly responsive web page.
If you've got a situation where there are 1000 options, but usually only a small number -- say, O(10) -- are selected, then perhaps an AJAX autocomplete widget of some kind would be a better approach. If the user is going to select a lot more options, then you might need to use a more exotic widget that avoids the need to transfer full lists back and forth.
Yours,
Russ Magee %-)
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com (mailto:django...@googlegroups.com).
> To unsubscribe from this group, send email to django-users...@googlegroups.com (mailto:django-users...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
It's also probable that it's something that is new to 1.4 (or, at least, that it manifests in slightly different ways in 1.4). One of the features added in 1.4 is bulk insertion of data. This means that you can use a single SQL statement to insert all your m2m relation; however, the downside is that on SQLite, there is a limit of 500 insertions that can be done at any one time (2 values per insertion).This is logged as ticket #17788. There have been some discussions about a fix for this problem that will break the bulk insertion into batches. I suspect that when this problem is fixed, your problem will go away.
what's wrong with:
qs.filter((Q(id__in=large_list[:n])|Q(id__in=large_list[n:]))) ?
> 1. Use different database. I guess you have a reason to use SQLite so this
> might not be an option.
Oracle has a 1000-element limit for the IN (....) clause. Of course,
it does work with (IN(<1sthalf>) or IN(<2ndhalf>))
--
Javier
I use SQlite3 on lower traffic production sites due to it's ease of install
and deployment. Even though I only once I reached this 1000 variable limit I
would like to see some django work around.
- Anssi
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to
django-users...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
Daniel Sokolowski
Web Engineer
KL Insight
http://klinsight.com/
Tel: 613-344-2116 | Fax: 613.634.7029
993 Princess Street, Suite 212
Kingston, ON K7L 1H3, Canada