Initial commit: standalone Django accounting API with admin JWT authorization
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
27
accounting/migrations/0002_seed_chart_of_accounts.py
Normal file
27
accounting/migrations/0002_seed_chart_of_accounts.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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),
|
||||
]
|
||||
Reference in New Issue
Block a user