﻿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
13532	Error in F() object docs	Erik Wognsen	Erik Wognsen	"[http://docs.djangoproject.com/en/dev/topics/db/queries/#filters-can-reference-fields-on-the-model] says:

""To find all the blog entries with twice as many comments as pingbacks, we modify the query:""
{{{
>>> Entry.objects.filter(n_pingbacks__lt=F('n_comments') * 2)
}}}
But the query should in fact have been:
{{{
>>> Entry.objects.filter(n_pingbacks=F('n_comments') / 2)
}}}
And to find entries with ''at least'' twice as many comments as pingbacks:
{{{
>>> Entry.objects.filter(n_pingbacks__lte=F('n_comments') / 2)
}}}

It would probably be easier to understand the sentences where comments come before pingbacks (""twice as many comments as pingbacks""), if they had the same order in the query. Again, to find entries with ''at least'' twice as many comments as pingbacks:
{{{
>>> Entry.objects.filter(n_comments__gte=F('n_pingbacks') * 2)
}}}
"		closed	Documentation			fixed			Accepted	1	0	0	0	0	0
