Possible bug when filter per __month on a variable generated by annotate
p = Person.objects.annotate(
main_date=Case(
When(ok=True, then='date_a'),
default=F('date_b'),
output_field=DateField()
)
)
a = p.filter(main_date__month=9)
print(a)
IndexError at /
tuple index out of range
Traceback:
File
"/Users/zzzzz/.virtualenvs/dddd/lib/python3.4/site-packages/django/core/handlers/base.py"
in get_response
132. response = wrapped_callback(request, *
callback_args, **callback_kwargs)
File "/Users/zzzzz/projects/myapp/views.py" in persons
42. print(a):
File
"/Users/zzzzz/.virtualenvs/dddd/lib/python3.4/site-packages/django/db/models/query.py"
in __iter__
162. self._fetch_all()
File
"/Users/zzzzz/.virtualenvs/dddd/lib/python3.4/site-packages/django/db/models/query.py"
in _fetch_all
965. self._result_cache = list(self.iterator())
File
"/Users/zzzzz/.virtualenvs/dddd/lib/python3.4/site-packages/django/db/models/query.py"
in iterator
238. results = compiler.execute_sql()
File
"/Users/zzzzz/.virtualenvs/dddd/lib/python3.4/site-packages/django/db/models/sql/compiler.py"
in execute_sql
840. cursor.execute(sql, params)
File
"/Users/zzzzz/.virtualenvs/dddd/lib/python3.4/site-packages/django/db/backends/utils.py"
in execute
79. return super(CursorDebugWrapper, self).execute(sql, params
)
File
"/Users/zzzzz/.virtualenvs/dddd/lib/python3.4/site-packages/django/db/backends/utils.py"
in execute
64. return self.cursor.execute(sql, params)
Exception Type: IndexError at /
Exception Value: tuple index out of range
but when I use __range works
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/4e4cf468-b5d1-4961-a95d-882e95b61b38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.