1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

ExportTemplate.template_language to slug (#3569)

This commit is contained in:
Jeremy Stretch
2019-12-05 17:01:00 -05:00
parent 2583823e5f
commit 89e720cb77
6 changed files with 61 additions and 14 deletions

View File

@ -1,5 +1,4 @@
from django.db import migrations, models
import django.db.models.deletion
OBJECTCHANGE_ACTION_CHOICES = (

View File

@ -0,0 +1,35 @@
from django.db import migrations, models
EXPORTTEMPLATE_LANGUAGE_CHOICES = (
(10, 'django'),
(20, 'jinja2'),
)
def exporttemplate_language_to_slug(apps, schema_editor):
ExportTemplate = apps.get_model('extras', 'ExportTemplate')
for id, slug in EXPORTTEMPLATE_LANGUAGE_CHOICES:
ExportTemplate.objects.filter(template_language=str(id)).update(template_language=slug)
class Migration(migrations.Migration):
atomic = False
dependencies = [
('extras', '0030_3569_objectchange_fields'),
]
operations = [
# ExportTemplate.template_language
migrations.AlterField(
model_name='exporttemplate',
name='template_language',
field=models.CharField(default='jinja2', max_length=50),
),
migrations.RunPython(
code=exporttemplate_language_to_slug
),
]