﻿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
36066	Document that Q objects can be used directly in annotations	Laurent Bergeron	Samruddhi Dharankar	"I needed to annotate something to a queryset and found a solution that looked like this:
{{{
queryset = MyModel.objects.annotate(
    created_less_than_hour_ago=Q(time_of_creation__gt=(now() - timedelta(hours=1)))
)
}}}

It worked fine and ""created_less_than_hour_ago"" was set to True if the object was created less than an hour ago and to False otherwise. I found another way to achieve this though because I didn't find any documentation about the use of Q objects inside of the annotate method, so I couldn't understand why and how it worked.

So, here I am asking for documentation about it.
"	Cleanup/optimization	closed	Database layer (models, ORM)	5.1	Normal	fixed	documentation		Ready for checkin	1	0	0	0	1	0
