From 84754080ea175b5de0d1def7caca0d416d372d34 Mon Sep 17 00:00:00 2001 From: Douglas Paz Date: Thu, 4 Oct 2018 09:59:31 -0300 Subject: [PATCH] Fix #209 --- bothub/common/migrations/0021_auto_20180921_1259.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bothub/common/migrations/0021_auto_20180921_1259.py b/bothub/common/migrations/0021_auto_20180921_1259.py index 928d62e24..b44f40469 100644 --- a/bothub/common/migrations/0021_auto_20180921_1259.py +++ b/bothub/common/migrations/0021_auto_20180921_1259.py @@ -5,6 +5,11 @@ import re +def populate_empty_intent(apps, *args): + RepositoryExample = apps.get_model('common', 'RepositoryExample') + RepositoryExample.objects.filter(intent='').update(intent='no_intent') + + class Migration(migrations.Migration): dependencies = [ @@ -17,4 +22,5 @@ class Migration(migrations.Migration): name='intent', field=models.CharField(default='no_intent', help_text='Example intent reference', max_length=64, validators=[django.core.validators.RegexValidator(re.compile('^[-a-z0-9_]+\\Z'), 'Enter a valid value consisting of lowercase letters, numbers, underscores or hyphens.', 'invalid')], verbose_name='intent'), ), + migrations.RunPython(populate_empty_intent), ]