make larger text in forms
[wolnelektury.git] / src / catalogue / migrations / 0019_auto_20171221_1107.py
1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
3
4 from django.db import migrations, models
5
6
7 def init_tag_for_books_pictures(apps, schema_editor):
8     Tag = apps.get_model('catalogue', 'Tag')
9     db_alias = schema_editor.connection.alias
10     tag_objects = Tag.objects.using(db_alias).exclude(category='set')
11     tags_for_books = tag_objects.filter(items__content_type__model__in=('book', 'fragment')).distinct()
12     tags_for_books.update(for_books=True)
13     tags_for_pictures = tag_objects.filter(items__content_type__model__in=('picture', 'picturearea')).distinct()
14     tags_for_pictures.update(for_pictures=True)
15
16
17 class Migration(migrations.Migration):
18
19     dependencies = [
20         ('catalogue', '0018_auto_20171221_1106'),
21     ]
22
23     operations = [
24         migrations.AddField(
25             model_name='tag',
26             name='for_books',
27             field=models.BooleanField(default=False),
28         ),
29         migrations.AddField(
30             model_name='tag',
31             name='for_pictures',
32             field=models.BooleanField(default=False),
33         ),
34         migrations.RunPython(init_tag_for_books_pictures, migrations.RunPython.noop)
35     ]