fixes
[wolnelektury.git] / src / picture / migrations / 0001_initial.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 os.path import join
5 from django.conf import settings
6 from django.db import models, migrations
7 import django.db.models.deletion
8 import sorl.thumbnail.fields
9 import django.core.files.storage
10
11
12 class Migration(migrations.Migration):
13
14     dependencies = [
15     ]
16
17     operations = [
18         migrations.CreateModel(
19             name='Picture',
20             fields=[
21                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
22                 ('title', models.CharField(max_length=120, verbose_name='Title')),
23                 ('slug', models.SlugField(unique=True, max_length=120, verbose_name='Slug')),
24                 ('sort_key', models.CharField(verbose_name='Sort key', max_length=120, editable=False, db_index=True)),
25                 ('sort_key_author', models.CharField(default='', verbose_name='sort key by author', max_length=120, editable=False, db_index=True)),
26                 ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='creation date', db_index=True)),
27                 ('changed_at', models.DateTimeField(auto_now=True, verbose_name='creation date', db_index=True)),
28                 ('xml_file', models.FileField(upload_to='xml', storage=django.core.files.storage.FileSystemStorage(base_url='/media/pictures/', location=join(settings.MEDIA_ROOT, 'pictures')), verbose_name='xml_file')),
29                 ('image_file', sorl.thumbnail.fields.ImageField(upload_to='images', storage=django.core.files.storage.FileSystemStorage(base_url='/media/pictures/', location=join(settings.MEDIA_ROOT, 'pictures')), verbose_name='image_file')),
30                 ('html_file', models.FileField(upload_to='html', storage=django.core.files.storage.FileSystemStorage(base_url='/media/pictures/', location=join(settings.MEDIA_ROOT, 'pictures')), verbose_name='html_file')),
31                 ('areas_json', models.TextField(default='{}', verbose_name='picture areas JSON', editable=False)),
32                 ('extra_info', models.TextField(default={}, verbose_name='Additional information')),
33                 ('culturepl_link', models.CharField(max_length=240, blank=True)),
34                 ('wiki_link', models.CharField(max_length=240, blank=True)),
35                 ('_related_info', models.TextField(null=True, editable=False, blank=True)),
36                 ('width', models.IntegerField(null=True)),
37                 ('height', models.IntegerField(null=True)),
38             ],
39             options={
40                 'ordering': ('sort_key',),
41                 'verbose_name': 'picture',
42                 'verbose_name_plural': 'pictures',
43             },
44             bases=(models.Model,),
45         ),
46         migrations.CreateModel(
47             name='PictureArea',
48             fields=[
49                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
50                 ('area', models.TextField(default='{}', verbose_name='area', editable=False)),
51                 ('kind', models.CharField(db_index=True, max_length=10, verbose_name='form', choices=[('thing', 'thing'), ('theme', 'motif')])),
52                 ('picture', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='areas', to='picture.Picture')),
53             ],
54             options={
55             },
56             bases=(models.Model,),
57         ),
58     ]