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 23349,Document that migrations must have dependencies in order to access other apps' models,Richard Eames,nobody,"When using `migrations.RunPython` the first parameter passed to the function is documented as being equivalent to South's `orm['app.Model']`. In South, the orm has a complete view of all the models, whereas the `app` parameter only contains apps/models for which the current migration depends on. I've attached a simple project. To demonstrate this issue, run `python manage.py migrate` in the app. The project contains 3 apps: spam, eggs, and cheese. There are dependencies between spam and eggs, but cheese is isolated. I created an empty migration in eggs, and print all the models I can find via the `apps` parameter. I was expecting it to output all of the models in all three apps, but instead it only prints the models for which the migration depends on. The apps models are as follows: eggs: Egg (links to spam.Beef) cheese: Cheese (no links) spam: Beef (no links), Potato( links to spam.Beef) I created an empty migration in eggs which lists all the models in the apps parameter, this is what it prints: {{{ # print(cls) for cls in (for cls in apps.get_app_configs()) AppConfigStub: eggs class 'Egg' AppConfigSub: spam class 'Beef' class 'Potato' ---- # print(cls) for cls in apps.get_models() class 'Egg' class 'Beef' class 'Potato' }}} Notice how it neglects to print out anything from the 'cheese' app.",Cleanup/optimization,closed,Documentation,1.7-rc-3,Normal,fixed,,,Accepted,0,0,0,0,0,0