1- from django .db import migrations
2-
3-
4- def add_state_medication_data (apps , schema_editor ):
5- StateMedication = apps .get_model ('api' , 'StateMedication' )
1+ # Generated by Django 4.2.3 on 2023-12-01 10:39
62
7- # Define your data
8- state_medication_data = [
9- {'state' : 'mania' , 'first' : 'mania-first' ,
10- 'second' : 'mania-second' , 'third' : 'mania-third' },
11- {'state' : 'hypomanic' , 'first' : 'hypomanic-first' ,
12- 'second' : 'hypomanic-second' , 'third' : 'hypomanic-third' },
13- {'state' : 'depressed' , 'first' : 'depressed-first' ,
14- 'second' : 'depressed-second' , 'third' : 'depressed-third' },
15- {'state' : 'euthymic' , 'first' : 'euthymic-first' ,
16- 'second' : 'euthymic-second' , 'third' : 'euthymic-third' },
17- ]
18-
19- # Insert the data into the StateMedication table
20- for med in state_medication_data :
21- StateMedication .objects .create (** med )
3+ from django .db import migrations
224
235
246class Migration (migrations .Migration ):
@@ -28,5 +10,4 @@ class Migration(migrations.Migration):
2810 ]
2911
3012 operations = [
31- migrations .RunPython (add_state_medication_data ),
3213 ]
0 commit comments