﻿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
31860	"""__date"" in F expression not working, have to use Func()"	Aleksandr Smechov	nobody	"When filtering a query for two equal datetime fields (both being timestamps), and using {{{__date}}}, the {{{__date}}} in the F expression remains a timestamp.

For example:

{{{
Author.objects.filter(
    Q(articles__isnull=False) 
    & Q(articles__date_published__date=F(""articles__date_edited__date""))
)
}}}


This will return an empty set, as {{{F(""articles__date_edited__date"")}}} remains a timestamp. I instead have to revert to using Func. 

{{{
Author.objects.annotate(
    date_edited=Func(F(""articles__date_edited""), function=""DATE""))
    .filter(Q(articles__isnull=False) & Q(articles__date_published__date=F(""date_edited""))
)
}}}

The above works. Not sure if relevant, but in settings I have USE_TZ enabled."	Bug	new	Database layer (models, ORM)	3.1	Normal				Unreviewed	0	0	0	0	0	0
