1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 Adds all of the models previously in `catalogue` app.
6 This is purely a state migration. If at any point a decisiion
7 is made to remove previous `catalogue` migrations, this will need
8 to be converted to a real database migration.
12 from django.conf import settings
13 import django.contrib.auth.models
14 import django.core.files.storage
15 from django.db import migrations, models
16 import django.db.models.deletion
20 class Migration(migrations.Migration):
25 ('auth', '0011_update_proxy_permissions'),
26 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
27 ('cover', '0002_auto_20191002_1224'),
28 ('catalogue', '0005_auto_20200322_2114'),
32 migrations.CreateModel(
35 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
36 ('title', models.CharField(db_index=True, max_length=255, verbose_name='title')),
37 ('slug', models.SlugField(max_length=128, unique=True, verbose_name='slug')),
38 ('public', models.BooleanField(db_index=True, default=True, verbose_name='public')),
39 ('gallery', models.CharField(blank=True, max_length=255, verbose_name='scan gallery name')),
40 ('parent_number', models.IntegerField(blank=True, db_index=True, editable=False, null=True, verbose_name='parent number')),
41 ('_single', models.NullBooleanField(db_index=True, editable=False)),
42 ('_new_publishable', models.NullBooleanField(editable=False)),
43 ('_published', models.NullBooleanField(editable=False)),
44 ('_on_track', models.IntegerField(blank=True, db_index=True, editable=False, null=True)),
45 ('dc_slug', models.CharField(blank=True, db_index=True, editable=False, max_length=128, null=True)),
46 ('dc_cover_image', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cover.Image')),
47 ('parent', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='documents.Book', verbose_name='parent')),
50 'verbose_name': 'book',
51 'verbose_name_plural': 'books',
52 'db_table': 'catalogue_book',
53 'ordering': ['title', 'slug'],
56 migrations.CreateModel(
57 name='BookPublishRecord',
59 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
60 ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='time')),
61 ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='publish_log', to='documents.Book', verbose_name='book')),
62 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user')),
65 'verbose_name': 'book publish record',
66 'verbose_name_plural': 'book publish records',
67 'db_table': 'catalogue_bookpublishrecord',
68 'ordering': ['-timestamp'],
71 migrations.CreateModel(
74 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
75 ('number', models.IntegerField(verbose_name='number')),
76 ('title', models.CharField(blank=True, max_length=255, verbose_name='title')),
77 ('slug', models.SlugField(verbose_name='slug')),
78 ('gallery_start', models.IntegerField(blank=True, default=1, null=True, verbose_name='gallery start')),
79 ('_hidden', models.NullBooleanField(editable=False)),
80 ('_changed', models.NullBooleanField(editable=False)),
81 ('_new_publishable', models.NullBooleanField(editable=False)),
82 ('book', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='documents.Book', verbose_name='book')),
83 ('creator', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_chunk', to=settings.AUTH_USER_MODEL, verbose_name='creator')),
86 'verbose_name': 'chunk',
87 'verbose_name_plural': 'chunks',
88 'db_table': 'catalogue_chunk',
89 'ordering': ['number'],
90 'permissions': [('can_pubmark', 'Can mark for publishing')],
93 migrations.CreateModel(
96 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
97 ('author_name', models.CharField(blank=True, help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author name')),
98 ('author_email', models.CharField(blank=True, help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author email')),
99 ('revision', models.IntegerField(db_index=True, verbose_name='revision')),
100 ('description', models.TextField(blank=True, default='', verbose_name='description')),
101 ('created_at', models.DateTimeField(db_index=True, default=datetime.datetime.now, editable=False)),
102 ('publishable', models.BooleanField(default=False, verbose_name='publishable')),
103 ('data', models.FileField(storage=django.core.files.storage.FileSystemStorage(location=settings.CATALOGUE_REPO_PATH), upload_to=dvcs.models.data_upload_to, verbose_name='data')),
104 ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='author')),
105 ('merge_parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='merge_children', to='documents.ChunkChange', verbose_name='merge parent')),
106 ('parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='documents.ChunkChange', verbose_name='parent')),
109 'verbose_name': 'change for: chunk',
110 'verbose_name_plural': 'changes for: chunk',
111 'db_table': 'catalogue_chunkchange',
112 'ordering': ('created_at',),
116 migrations.CreateModel(
119 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
120 ('name', models.CharField(max_length=64, verbose_name='name')),
121 ('slug', models.SlugField(blank=True, max_length=64, null=True, unique=True, verbose_name='slug')),
122 ('ordering', models.IntegerField(verbose_name='ordering')),
125 'verbose_name': 'tag for: chunk',
126 'verbose_name_plural': 'tags for: chunk',
127 'db_table': 'catalogue_chunktag',
128 'ordering': ['ordering'],
132 migrations.CreateModel(
135 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
136 ('image', models.FileField(upload_to='catalogue/images', verbose_name='image')),
137 ('title', models.CharField(blank=True, max_length=255, verbose_name='title')),
138 ('slug', models.SlugField(unique=True, verbose_name='slug')),
139 ('public', models.BooleanField(db_index=True, default=True, verbose_name='public')),
140 ('_new_publishable', models.NullBooleanField(editable=False)),
141 ('_published', models.NullBooleanField(editable=False)),
142 ('_changed', models.NullBooleanField(editable=False)),
143 ('creator', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_image', to=settings.AUTH_USER_MODEL, verbose_name='creator')),
146 'verbose_name': 'image',
147 'verbose_name_plural': 'images',
148 'db_table': 'catalogue_image',
149 'ordering': ['title'],
150 'permissions': [('can_pubmark_image', 'Can mark images for publishing')],
153 migrations.CreateModel(
156 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
157 ('author_name', models.CharField(blank=True, help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author name')),
158 ('author_email', models.CharField(blank=True, help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author email')),
159 ('revision', models.IntegerField(db_index=True, verbose_name='revision')),
160 ('description', models.TextField(blank=True, default='', verbose_name='description')),
161 ('created_at', models.DateTimeField(db_index=True, default=datetime.datetime.now, editable=False)),
162 ('publishable', models.BooleanField(default=False, verbose_name='publishable')),
163 ('data', models.FileField(storage=django.core.files.storage.FileSystemStorage(location=settings.CATALOGUE_IMAGE_REPO_PATH), upload_to=dvcs.models.data_upload_to, verbose_name='data')),
164 ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='author')),
165 ('merge_parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='merge_children', to='documents.ImageChange', verbose_name='merge parent')),
166 ('parent', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='documents.ImageChange', verbose_name='parent')),
169 'verbose_name': 'change for: image',
170 'verbose_name_plural': 'changes for: image',
171 'db_table': 'catalogue_imagechange',
172 'ordering': ('created_at',),
176 migrations.CreateModel(
179 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
180 ('name', models.CharField(max_length=64, verbose_name='name')),
181 ('slug', models.SlugField(blank=True, max_length=64, null=True, unique=True, verbose_name='slug')),
182 ('ordering', models.IntegerField(verbose_name='ordering')),
185 'verbose_name': 'tag for: image',
186 'verbose_name_plural': 'tags for: image',
187 'db_table': 'catalogue_imagetag',
188 'ordering': ['ordering'],
192 migrations.CreateModel(
195 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
196 ('name', models.CharField(max_length=255, unique=True, verbose_name='name')),
197 ('notes', models.TextField(blank=True, null=True, verbose_name='notes')),
200 'verbose_name': 'project',
201 'verbose_name_plural': 'projects',
202 'db_table': 'catalogue_project',
203 'ordering': ['name'],
206 migrations.CreateModel(
215 bases=('auth.user',),
217 ('objects', django.contrib.auth.models.UserManager()),
220 migrations.CreateModel(
221 name='ImagePublishRecord',
223 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
224 ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='time')),
225 ('change', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='publish_log', to='documents.ImageChange', verbose_name='change')),
226 ('image', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='publish_log', to='documents.Image', verbose_name='image')),
227 ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user')),
230 'verbose_name': 'image publish record',
231 'verbose_name_plural': 'image publish records',
232 'db_table': 'catalogue_imagepublishrecord',
233 'ordering': ['-timestamp'],
237 model_name='imagechange',
239 field=models.ManyToManyField(related_name='change_set', to='documents.ImageTag', verbose_name='tags'),
242 model_name='imagechange',
244 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='change_set', to='documents.Image', verbose_name='document'),
249 field=models.ForeignKey(blank=True, default=None, editable=False, help_text="This document's current head.", null=True, on_delete=django.db.models.deletion.SET_NULL, to='documents.ImageChange', verbose_name='head'),
254 field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='documents.Project'),
259 field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='documents.ImageTag', verbose_name='stage'),
264 field=models.ForeignKey(blank=True, help_text='Work assignment.', null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='user'),
266 migrations.CreateModel(
267 name='ChunkPublishRecord',
269 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
270 ('book_record', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='documents.BookPublishRecord', verbose_name='book publish record')),
271 ('change', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='publish_log', to='documents.ChunkChange', verbose_name='change')),
274 'verbose_name': 'chunk publish record',
275 'verbose_name_plural': 'chunk publish records',
276 'db_table': 'catalogue_chunkpublishrecord',
280 model_name='chunkchange',
282 field=models.ManyToManyField(related_name='change_set', to='documents.ChunkTag', verbose_name='tags'),
285 model_name='chunkchange',
287 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='change_set', to='documents.Chunk', verbose_name='document'),
292 field=models.ForeignKey(blank=True, default=None, editable=False, help_text="This document's current head.", null=True, on_delete=django.db.models.deletion.SET_NULL, to='documents.ChunkChange', verbose_name='head'),
297 field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='documents.ChunkTag', verbose_name='stage'),
302 field=models.ForeignKey(blank=True, help_text='Work assignment.', null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='user'),
307 field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='documents.Project'),
309 migrations.AlterUniqueTogether(
311 unique_together={('tree', 'revision')},
313 migrations.AlterUniqueTogether(
315 unique_together={('tree', 'revision')},
317 migrations.AlterUniqueTogether(
319 unique_together={('book', 'slug'), ('book', 'number')},
324 migrations.SeparateDatabaseAndState(
325 database_operations=[],
326 state_operations=_state_operations,