Add 'slug' attributes and migration step

This commit is contained in:
Christophe Boulanger 2017-03-23 13:03:46 +01:00
parent 1ee1ff8670
commit f4866bc974
2 changed files with 28 additions and 0 deletions

View File

@ -32,6 +32,7 @@ class Command(BaseCommand):
data = json.load(data_file)
for motivationterm in data:
mt_object = MotivationTerm(text=motivationterm["text"],
slug=motivationterm["slug"],
price=motivationterm["price"],
description=motivationterm["description"])
mt_object.save()
@ -42,6 +43,7 @@ class Command(BaseCommand):
data = json.load(data_file)
for destinationterm in data:
mt_object = DestinationTerm(text=destinationterm["text"],
slug=destinationterm["slug"],
price=destinationterm["price"],
description=destinationterm["description"],
paymentrequired=destinationterm["paymentRequired"])

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('passerelle_imio_ts1_datasources', '0002_destinationterm'),
]
operations = [
migrations.AddField(
model_name='destinationterm',
name='slug',
field=models.CharField(default='slug', max_length=100),
preserve_default=False,
),
migrations.AddField(
model_name='motivationterm',
name='slug',
field=models.CharField(default='slug', max_length=100),
preserve_default=False,
),
]