-
Notifications
You must be signed in to change notification settings - Fork 226
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
TypeError: object of type 'Query' has no len() #29
Comments
It looks like you are using subquery. I created a test for it and it does not fail for me. Please check if this test is failing for you and if it is then tell me more about your setup (django version is particularly important). If test passes then can you tweak it to fail by better representing your issue? |
At least can you post an expression causing this error? |
sorry for the delay. looks like its happening specifically on an exclude query when accessing a variable on a relationnship i.e UserProfile.objects.exclude(user__characteristics__email_confirmed=True) if i do the following UserProfile.objects.exclude(Q(user__characteristics__email_confirmed=True)) then it works fine. |
Tried your test. It passes. |
I know it passes on mine too :( but fails in my real app.
|
I get the same error. It fails both on my local and live version. "TypeError: object of type ‘Query’ has no len()" I am using a custom manager that includes a query with an exclude call. This happens in two places where i have similar methods. I'm still trying to debug it, currently I'm just ignoring these models.
I'm not exactly sure what the issue is, but thanks for the great app! I'll keep trying to look into it... |
Can you cut a part of your application into a test? It would be very helpful, right now I don't have a clue how I can reproduce that. |
Yeah sorry about that. Not exactly sure how to do that yet, but just wanted to leave feedback. How can I structure a test that would be helpful to you but totally app independent...? On Fri, Apr 12, 2013 at 6:24 PM, Alexander Schepanovski
|
The way I would do that:
|
Get the following error on a offset/limit query
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/django/db/models/query.py", line 118, in _result_iter
self._fill_cache()
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/django/db/models/query.py", line 892, in _fill_cache
self._result_cache.append(self._iter.next())
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/query.py", line 327, in iterator
self._cache_results(cache_key, results)
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/query.py", line 230, in _cache_results
cond_dnf = dnf(self)
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/utils.py", line 107, in dnf
result = _dnf(where)
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/utils.py", line 83, in _dnf
chilren_dnfs = filter(None, imap(_dnf, where.children))
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/utils.py", line 83, in _dnf
chilren_dnfs = filter(None, imap(_dnf, where.children))
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/utils.py", line 83, in _dnf
chilren_dnfs = filter(None, imap(_dnf, where.children))
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/utils.py", line 83, in _dnf
chilren_dnfs = filter(None, imap(_dnf, where.children))
File "/home/harshil/workspace/seedinvest/local/lib/python2.7/site-packages/cacheops/utils.py", line 74, in _dnf
elif lookup == 'in' and len(value) < LONG_DISJUNCTION:
TypeError: object of type 'Query' has no len()
The text was updated successfully, but these errors were encountered: