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