File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55from django .db import migrations , models
66
77
8+ data = [
9+ {
10+ "command" : "xym" ,
11+ "switch" : "--version" ,
12+ "used" : True ,
13+ "version" : "xym 0.3.2"
14+ },
15+ {
16+ "command" : "pyang" ,
17+ "switch" : "--version" ,
18+ "used" : True ,
19+ "version" : "pyang 1.7.2"
20+ },
21+ {
22+ "command" : "yanglint" ,
23+ "switch" : "--version" ,
24+ "used" : True ,
25+ "version" : "yanglint 0.12.183"
26+ }
27+ ]
28+
29+ def forwards (apps , schema_editor ):
30+ VersionInfo = apps .get_model ('utils' , 'VersionInfo' )
31+ for item in data :
32+ VersionInfo .objects .create (** item )
33+
34+ def backwards (apps , schema_editor ):
35+ pass
36+
837class Migration (migrations .Migration ):
938
1039 dependencies = [
@@ -26,4 +55,5 @@ class Migration(migrations.Migration):
2655 'verbose_name_plural' : 'VersionInfo' ,
2756 },
2857 ),
58+ migrations .RunPython (forwards , backwards ),
2959 ]
You can’t perform that action at this time.
0 commit comments