﻿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
22416	Migrate can't create ManyToManyField for Model migrated in the same run	roughdesignapps@…	nobody	"I have a fresh database and created the inital migrations.

When trying to apply the migrations with 'migrate <appname>', I get
{{{
django.db.utils.ProgrammingError: (1146, ""Table '<WEBSITENAME>.django_content_type' doesn't exist"")
}}}
Makes sense so far as django_content_type is from another app.

Running 'migrate' (without app name) runs through my first app OK.
When it runs through the migrations for the second app, I get
{{{
ValueError: Related model 'appname.Modelname' cannot be resolved
}}}
I checked the spelling in the migrations inital file, it's fine.

The Model with the field which gives the error contains 2 ManyToManyFields, let's call them A and B for convenience. They are identical except for the model they reference.

Field A relates to a model from a third app,
which has not been handled by migrations by then.
Field B relates to a model from the first app.

In the migrations file (and the model), Field A is mentioned first and gives no errors.
Field B is mentioned after Field A and raises the ValueError."	Cleanup/optimization	closed	Migrations	1.7-alpha-2	Normal	needsinfo			Accepted	0	0	0	0	0	0
