from django.db import migrations from accounting.seeding import seed_default_data def seed(apps, schema_editor): Account = apps.get_model('accounting', 'Account') CompanySettings = apps.get_model('accounting', 'CompanySettings') seed_default_data(Account, CompanySettings) def unseed(apps, schema_editor): Account = apps.get_model('accounting', 'Account') CompanySettings = apps.get_model('accounting', 'CompanySettings') CompanySettings.objects.all().delete() Account.objects.all().delete() class Migration(migrations.Migration): dependencies = [ ('accounting', '0001_initial'), ] operations = [ migrations.RunPython(seed, unseed), ]