Added initial data to the versioninfo migration.

- Legacy-Id: 13638
This commit is contained in:
Henrik Levkowetz 2017-06-16 08:55:31 +00:00
parent c4b64e51af
commit 8d420d4d2f

View file

@ -5,6 +5,35 @@ from __future__ import unicode_literals
from django.db import migrations, models
data = [
{
"command": "xym",
"switch": "--version",
"used": True,
"version": "xym 0.3.2"
},
{
"command": "pyang",
"switch": "--version",
"used": True,
"version": "pyang 1.7.2"
},
{
"command": "yanglint",
"switch": "--version",
"used": True,
"version": "yanglint 0.12.183"
}
]
def forwards(apps, schema_editor):
VersionInfo = apps.get_model('utils', 'VersionInfo')
for item in data:
VersionInfo.objects.create(**item)
def backwards(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
@ -26,4 +55,5 @@ class Migration(migrations.Migration):
'verbose_name_plural': 'VersionInfo',
},
),
migrations.RunPython(forwards, backwards),
]