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