﻿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
11670	Model fields named 'year', 'month', 'gt', 'lt' etc. get mistaken for lookup types in lookups across relations	andy@…	Julien Phalip	"Using a field named 'year' in a related table:

{{{
Event.objects.filter(eventinfo__year=settings.YEAR)
}}}

Throws a type error:

{{{
TypeError at /events/submit_review/
Related Field has invalid lookup: year
}}}

The problem is easily worked around by specifying a type of match to use (I used the exact keyword):

{{{
Event.objects.filter(eventinfo__year__exact=settings.YEAR)
}}}

I suspect this is a clash with the date field lookup functions.  I'm not sure if this is a bug or if it's just something to mention in the documentation for related searches.
"	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed		joel@… anssi.kaariainen@… Anssi Kääriäinen	Accepted	1	0	0	0	0	0
