﻿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
19669	Django doesn't check type on foreign key query	ram@…	nobody	"I can only test on 1.4.x and not 1.5.x, so if someone can test on 1.5.x that would help. (If the bug was already found and fixed in 1.5.x I'll be happy!)

If you're making a lookup that includes a foreign-key field, and you pass in an object of a different type, Django doesn't complain but just uses the ID of the object you put in even if it's of a different type.

Example:

    Chair.objects.filter(user=site)

If you pass in a `Site` object instead of a `User` object, Django will not raise an exception, but will look for a `Chair` whose `User` has an ID equal to that of `site`, which is probably never what the user wants and caused a hard-to-find bug for me in my application.

I suggest simply raising an exception in this case."	Bug	closed	Database layer (models, ORM)	1.4	Normal	duplicate			Unreviewed	0	0	0	0	0	0
