title: How to fix order of Django migrations?
body: <p>I have several apps in my Django 2.0.2 project. One of the apps (<code>app_one</code>) has a migration that depends on migrations from the other app (<code>app_two</code>) being installed. It is initial migration of <code>app_one</code> and it looks like this:</p>
  
  <pre><code>def import_data(apps, schema_editor):
      schema_model = apps.get_model('app_two', 'Model')
      # do import
  
  def drop_data(apps, schema_editor):
      schema_model = apps.get_model('app_two', 'Model')
      # undo import
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('app_two', '0005_auto_20180127_2155')
      ]
  
      operations = [
          migrations.RunPython(
              import_data, 
              reverse_code=drop_data
      )
  ]
  </code></pre>
  
  <p>Currently in order to install the database I need to <code>manage.py migrate app_two</code> and only after that do <code>manage.py migrate</code>, because otherwise I get an error on this migration that relation <code>Model</code> from <code>app_two</code> does not exist. Also I'm unable to run tests <code>manage.py test</code> normally due to the same error. It seems that Django ignores dependency in this migration for some reason. How do I fix that?</p>