Forgotten req.
[wolnelektury.git] / src / chunks / migrations / 0002_auto_20140911_1253.py
1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from django.db import models, migrations
5
6
7 def null_to_blank(apps, schema_editor):
8     Chunk = apps.get_model("chunks", "Chunk")
9     Chunk.objects.filter(content=None).update(content='')
10     Chunk.objects.filter(description=None).update(description='')
11
12
13 class Migration(migrations.Migration):
14
15     dependencies = [
16         ('chunks', '0001_initial'),
17     ]
18
19     operations = [
20         migrations.RunPython(null_to_blank),
21         migrations.AlterField(
22             model_name='chunk',
23             name='content',
24             field=models.TextField(verbose_name='content', blank=True),
25         ),
26         migrations.AlterField(
27             model_name='chunk',
28             name='description',
29             field=models.CharField(max_length=255, verbose_name='Description', blank=True),
30         ),
31     ]