﻿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
7498	ForeignKey doesn't check type on __init__	Kenneth Arnold	nobody	"The {{{ForeignKey}}} descriptor gives a {{{ValueError}}} (hm, should be a {{{TypeError}}}?) on assigning an invalidly typed object to a foreign key. But for {{{__init__}}}, it accepts anything that has a {{{id}}} field without question.

Testcase and initial patch attached. I'm marking ""needs better patch"" because I think the {{{AttributeError}}} case is no longer necessary, but I'm not sure. Also, the {{{TypeError}}} that is raised (in the existing code) could be more helpful.

This breaks a few things in regressiontests/queries/models.py, but I think those are test bugs (the variable {{{n1}}} is used both as a {{{Note}}} and a {{{Number}}}).
"		closed	Database layer (models, ORM)	dev		fixed		kenneth.arnold@…	Accepted	1	0	0	1	0	0
