﻿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
24282	Cannot Modify Foreign Keys Within Data Migrations	Jeff Singer	Markus Holtermann	"The following data migration works in 1.7, but fails in 1.8a1

{{{
def forwards(apps, schema_editor):
    A = apps.get_model('app_name', 'A')
    B = apps.get_model('app_name', 'B')
    
    a = A.objects.create()
    b = B(a=a)
}}}

Fails with:
{{{
    ValueError: Cannot assign ""<A: A object>"": ""B.a"" must be a ""A"" instance.
}}}

I believe that this is because the model classes returned `apps.get_model` aren't necessarily instances of the right type.

I'd be happy to create a failing test case, however, I'm new to the project, and would like a little direction on where that should go."	Bug	closed	Migrations	1.8alpha1	Release blocker	fixed			Accepted	1	0	0	0	0	0
