polyphonic/library/migrations/0003_orchestrations.py
2021-03-22 10:30:13 +11:00

28 lines
848 B
Python

# Generated by Django 3.1.1 on 2021-03-11 06:26
from django.db import migrations
ORCHESTRATIONS = {
'SATB': ('S', 'A', 'T', 'B'),
'String Quartet': ('Vln1', 'Vln2', 'Vla', 'Vc'),
'Chamber Orchestra': ('Vln1', 'Vln2', 'Vla', 'Vc', 'Cb',
'Fl1', 'Fl2', 'Cl1', 'Cl2', 'Ob1', 'Ob2', 'Hn1', 'Hn2',
'Tpt1', 'Tpt2', 'Tbn1', 'Tbn2', 'Tuba',
'Timp', 'Drum', 'Perc'),
}
def add_orchestrations(apps, schema_editor):
q = apps.get_model('library', 'Orchestration').objects
for name, instruments in ORCHESTRATIONS.items():
q.create(name=name, instruments=", ".join(instruments))
class Migration(migrations.Migration):
dependencies = [
('library', '0001_initial'),
]
operations = [
migrations.RunPython(add_orchestrations, lambda apps, schema_editor: None),
]