﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2211	[patch] exact, gt, gte, lt, lte, ne lookups fail for DateField fields	paolo@…	Adrian Holovaty	"Documentation about field lookups cites this example: {{{ Entry.objects.filter(pub_date__lte='2006-01-01') }}}

However, if pub_date is a !DateField field the query fails. Same thing with exact, gt, gte, lt, lte, ne lookups.
Using {{{ Entry.objects.filter(pub_date__lte=datetime.date()) }}} all works fine, though I don't think this is the intended way to make this kind of query.

In the admin site also there are some troubles caused by this behaviour. Try to add a !DateField field in list_filter for some model and ask for objects in 'Past 7 days'.

This is the traceback.

{{{
Traceback (most recent call last):
File ""/home/paolo/django_current/django/core/handlers/base.py"" in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File ""/home/paolo/django_current/django/contrib/admin/views/decorators.py"" in _checklogin
  54. return view_func(request, *args, **kwargs)
File ""/home/paolo/django_current/django/views/decorators/cache.py"" in _wrapped_view_func
  40. response = view_func(request, *args, **kwargs)
File ""/home/paolo/django_current/django/contrib/admin/views/main.py"" in change_list
  734. cl = ChangeList(request, model)
File ""/home/paolo/django_current/django/contrib/admin/views/main.py"" in __init__
  565. self.get_results(request)
File ""/home/paolo/django_current/django/contrib/admin/views/main.py"" in get_results
  624. result_list = list(self.query_set)
File ""/home/paolo/django_current/django/db/models/query.py"" in __iter__
  94. return iter(self._get_data())
File ""/home/paolo/django_current/django/db/models/query.py"" in _get_data
  412. self._result_cache = list(self.iterator())
File ""/home/paolo/django_current/django/db/models/query.py"" in iterator
  162. select, sql, params = self._get_sql_clause()
File ""/home/paolo/django_current/django/db/models/query.py"" in _get_sql_clause
  426. tables2, joins2, where2, params2 = self._filters.get_sql(opts)
File ""/home/paolo/django_current/django/db/models/query.py"" in get_sql
  557. tables2, joins2, where2, params2 = val.get_sql(opts)
File ""/home/paolo/django_current/django/db/models/query.py"" in get_sql
  606. return parse_lookup(self.kwargs.items(), opts)
File ""/home/paolo/django_current/django/db/models/query.py"" in parse_lookup
  716. tables2, joins2, where2, params2 = lookup_inner(path, clause, value, opts, opts.db_table, None)
File ""/home/paolo/django_current/django/db/models/query.py"" in lookup_inner
  876. params.extend(field.get_db_prep_lookup(clause, value))
File ""/home/paolo/django_current/django/db/models/fields/__init__.py"" in get_db_prep_lookup
  415. value = value.strftime('%Y-%m-%d')

  AttributeError at /admin/tessere/tessera/
  'str' object has no attribute 'strftime'
}}}"	defect	closed	Metasystem	dev	normal	fixed		paolo@…	Unreviewed	1	0	0	0	0	0
