5👍
Like @knbk said, you can’t take the migration out of it’s location. However, if you want your migration in between your other migrations, but have the fixture data in a separate file, you can do this:
from django.core.management import call_command
from django.db import models, migrations
class Migration(migrations.Migration):
def load_data(apps, schema_editor):
call_command("loaddata", "initial_data.json")
dependencies = [
('other_app', '0001_initial'),
]
operations = [
migrations.RunPython(load_data),
]
Django will look for the fixture file the same way it always has and your data gets loaded when you migrate your db.
Source:stackexchange.com