Switch compiler until an issue with libsasscompiler resolved.
[redakcja.git] / src / catalogue / migrations / 0001_initial.py
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.
3 #
4 from django.db import models, migrations
5 import datetime
6 import django.db.models.deletion
7 from django.conf import settings
8 import django.core.files.storage
9 import dvcs.models
10
11
12 class Migration(migrations.Migration):
13
14     dependencies = [
15         ('auth', '0001_initial'),
16         ('cover', '0001_initial'),
17         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
18     ]
19
20     operations = [
21         migrations.CreateModel(
22             name='Book',
23             fields=[
24                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
25                 ('title', models.CharField(max_length=255, verbose_name='title', db_index=True)),
26                 ('slug', models.SlugField(unique=True, max_length=128, verbose_name='slug')),
27                 ('public', models.BooleanField(default=True, db_index=True, verbose_name='public')),
28                 ('gallery', models.CharField(max_length=255, verbose_name='scan gallery name', blank=True)),
29                 ('parent_number', models.IntegerField(db_index=True, verbose_name='parent number', null=True, editable=False, blank=True)),
30                 ('_short_html', models.TextField(null=True, editable=False, blank=True)),
31                 ('_single', models.NullBooleanField(db_index=True, editable=False)),
32                 ('_new_publishable', models.NullBooleanField(editable=False)),
33                 ('_published', models.NullBooleanField(editable=False)),
34                 ('_on_track', models.IntegerField(db_index=True, null=True, editable=False, blank=True)),
35                 ('dc_slug', models.CharField(db_index=True, max_length=128, null=True, editable=False, blank=True)),
36             ],
37             options={
38                 'ordering': ['title', 'slug'],
39                 'verbose_name': 'book',
40                 'verbose_name_plural': 'books',
41             },
42             bases=(models.Model,),
43         ),
44         migrations.CreateModel(
45             name='BookPublishRecord',
46             fields=[
47                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
48                 ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='time')),
49                 ('book', models.ForeignKey(related_name='publish_log', verbose_name='book', to='catalogue.Book', on_delete=models.CASCADE)),
50                 ('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
51             ],
52             options={
53                 'ordering': ['-timestamp'],
54                 'verbose_name': 'book publish record',
55                 'verbose_name_plural': 'book publish records',
56             },
57             bases=(models.Model,),
58         ),
59         migrations.CreateModel(
60             name='Chunk',
61             fields=[
62                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
63                 ('number', models.IntegerField(verbose_name='number')),
64                 ('title', models.CharField(max_length=255, verbose_name='title', blank=True)),
65                 ('slug', models.SlugField(verbose_name='slug')),
66                 ('gallery_start', models.IntegerField(default=1, null=True, verbose_name='gallery start', blank=True)),
67                 ('_short_html', models.TextField(null=True, editable=False, blank=True)),
68                 ('_hidden', models.NullBooleanField(editable=False)),
69                 ('_changed', models.NullBooleanField(editable=False)),
70                 ('book', models.ForeignKey(editable=False, to='catalogue.Book', verbose_name='book', on_delete=models.CASCADE)),
71                 ('creator', models.ForeignKey(related_name='created_chunk', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='creator', on_delete=models.CASCADE)),
72             ],
73             options={
74                 'ordering': ['number'],
75                 'verbose_name': 'chunk',
76                 'verbose_name_plural': 'chunks',
77                 'permissions': [('can_pubmark', 'Can mark for publishing')],
78             },
79             bases=(models.Model,),
80         ),
81         migrations.CreateModel(
82             name='ChunkChange',
83             fields=[
84                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
85                 ('author_name', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author name', blank=True)),
86                 ('author_email', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author email', blank=True)),
87                 ('revision', models.IntegerField(verbose_name='revision', db_index=True)),
88                 ('description', models.TextField(default=b'', verbose_name='description', blank=True)),
89                 ('created_at', models.DateTimeField(default=datetime.datetime.now, editable=False, db_index=True)),
90                 ('publishable', models.BooleanField(default=False, verbose_name='publishable')),
91                 ('data', models.FileField(upload_to=dvcs.models.data_upload_to, storage=django.core.files.storage.FileSystemStorage(location=settings.CATALOGUE_REPO_PATH), verbose_name='data')),
92                 ('author', models.ForeignKey(verbose_name='author', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)),
93                 ('merge_parent', models.ForeignKey(related_name='merge_children', default=None, blank=True, to='catalogue.ChunkChange', null=True, verbose_name='merge parent', on_delete=models.CASCADE)),
94                 ('parent', models.ForeignKey(related_name='children', default=None, blank=True, to='catalogue.ChunkChange', null=True, verbose_name='parent', on_delete=models.CASCADE)),
95             ],
96             options={
97                 'ordering': ('created_at',),
98                 'abstract': False,
99                 'verbose_name': 'change for: chunk',
100                 'verbose_name_plural': 'changes for: chunk',
101             },
102             bases=(models.Model,),
103         ),
104         migrations.CreateModel(
105             name='ChunkPublishRecord',
106             fields=[
107                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
108                 ('book_record', models.ForeignKey(verbose_name='book publish record', to='catalogue.BookPublishRecord', on_delete=models.CASCADE)),
109                 ('change', models.ForeignKey(related_name='publish_log', verbose_name='change', to='catalogue.ChunkChange', on_delete=models.CASCADE)),
110             ],
111             options={
112                 'verbose_name': 'chunk publish record',
113                 'verbose_name_plural': 'chunk publish records',
114             },
115             bases=(models.Model,),
116         ),
117         migrations.CreateModel(
118             name='ChunkTag',
119             fields=[
120                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
121                 ('name', models.CharField(max_length=64, verbose_name='name')),
122                 ('slug', models.SlugField(null=True, max_length=64, blank=True, unique=True, verbose_name='slug')),
123                 ('ordering', models.IntegerField(verbose_name='ordering')),
124             ],
125             options={
126                 'ordering': ['ordering'],
127                 'abstract': False,
128                 'verbose_name': 'tag for: chunk',
129                 'verbose_name_plural': 'tags for: chunk',
130             },
131             bases=(models.Model,),
132         ),
133         migrations.CreateModel(
134             name='Image',
135             fields=[
136                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
137                 ('image', models.FileField(upload_to=b'catalogue/images', verbose_name='image')),
138                 ('title', models.CharField(max_length=255, verbose_name='title', blank=True)),
139                 ('slug', models.SlugField(unique=True, verbose_name='slug')),
140                 ('public', models.BooleanField(default=True, db_index=True, verbose_name='public')),
141                 ('_short_html', models.TextField(null=True, editable=False, blank=True)),
142                 ('_new_publishable', models.NullBooleanField(editable=False)),
143                 ('_published', models.NullBooleanField(editable=False)),
144                 ('_changed', models.NullBooleanField(editable=False)),
145                 ('creator', models.ForeignKey(related_name='created_image', blank=True, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='creator', on_delete=models.CASCADE)),
146             ],
147             options={
148                 'ordering': ['title'],
149                 'verbose_name': 'image',
150                 'verbose_name_plural': 'images',
151                 'permissions': [('can_pubmark_image', 'Can mark images for publishing')],
152             },
153             bases=(models.Model,),
154         ),
155         migrations.CreateModel(
156             name='ImageChange',
157             fields=[
158                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
159                 ('author_name', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author name', blank=True)),
160                 ('author_email', models.CharField(help_text='Used if author is not set.', max_length=128, null=True, verbose_name='author email', blank=True)),
161                 ('revision', models.IntegerField(verbose_name='revision', db_index=True)),
162                 ('description', models.TextField(default=b'', verbose_name='description', blank=True)),
163                 ('created_at', models.DateTimeField(default=datetime.datetime.now, editable=False, db_index=True)),
164                 ('publishable', models.BooleanField(default=False, verbose_name='publishable')),
165                 ('data', models.FileField(upload_to=dvcs.models.data_upload_to, storage=django.core.files.storage.FileSystemStorage(location=settings.CATALOGUE_IMAGE_REPO_PATH), verbose_name='data')),
166                 ('author', models.ForeignKey(verbose_name='author', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)),
167                 ('merge_parent', models.ForeignKey(related_name='merge_children', default=None, blank=True, to='catalogue.ImageChange', null=True, verbose_name='merge parent', on_delete=models.CASCADE)),
168                 ('parent', models.ForeignKey(related_name='children', default=None, blank=True, to='catalogue.ImageChange', null=True, verbose_name='parent', on_delete=models.CASCADE)),
169             ],
170             options={
171                 'ordering': ('created_at',),
172                 'abstract': False,
173                 'verbose_name': 'change for: image',
174                 'verbose_name_plural': 'changes for: image',
175             },
176             bases=(models.Model,),
177         ),
178         migrations.CreateModel(
179             name='ImagePublishRecord',
180             fields=[
181                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
182                 ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='time')),
183                 ('change', models.ForeignKey(related_name='publish_log', verbose_name='change', to='catalogue.ImageChange', on_delete=models.CASCADE)),
184                 ('image', models.ForeignKey(related_name='publish_log', verbose_name='image', to='catalogue.Image', on_delete=models.CASCADE)),
185                 ('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
186             ],
187             options={
188                 'ordering': ['-timestamp'],
189                 'verbose_name': 'image publish record',
190                 'verbose_name_plural': 'image publish records',
191             },
192             bases=(models.Model,),
193         ),
194         migrations.CreateModel(
195             name='ImageTag',
196             fields=[
197                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
198                 ('name', models.CharField(max_length=64, verbose_name='name')),
199                 ('slug', models.SlugField(null=True, max_length=64, blank=True, unique=True, verbose_name='slug')),
200                 ('ordering', models.IntegerField(verbose_name='ordering')),
201             ],
202             options={
203                 'ordering': ['ordering'],
204                 'abstract': False,
205                 'verbose_name': 'tag for: image',
206                 'verbose_name_plural': 'tags for: image',
207             },
208             bases=(models.Model,),
209         ),
210         migrations.CreateModel(
211             name='Project',
212             fields=[
213                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
214                 ('name', models.CharField(unique=True, max_length=255, verbose_name='name')),
215                 ('notes', models.TextField(null=True, verbose_name='notes', blank=True)),
216             ],
217             options={
218                 'ordering': ['name'],
219                 'verbose_name': 'project',
220                 'verbose_name_plural': 'projects',
221             },
222             bases=(models.Model,),
223         ),
224         migrations.AddField(
225             model_name='imagechange',
226             name='tags',
227             field=models.ManyToManyField(related_name='change_set', verbose_name='tags', to='catalogue.ImageTag'),
228             preserve_default=True,
229         ),
230         migrations.AddField(
231             model_name='imagechange',
232             name='tree',
233             field=models.ForeignKey(related_name='change_set', verbose_name='document', to='catalogue.Image', on_delete=models.CASCADE),
234             preserve_default=True,
235         ),
236         migrations.AlterUniqueTogether(
237             name='imagechange',
238             unique_together=set([('tree', 'revision')]),
239         ),
240         migrations.AddField(
241             model_name='image',
242             name='head',
243             field=models.ForeignKey(default=None, editable=False, to='catalogue.ImageChange', blank=True, help_text="This document's current head.", null=True, verbose_name='head', on_delete=models.CASCADE),
244             preserve_default=True,
245         ),
246         migrations.AddField(
247             model_name='image',
248             name='project',
249             field=models.ForeignKey(blank=True, to='catalogue.Project', null=True, on_delete=models.CASCADE),
250             preserve_default=True,
251         ),
252         migrations.AddField(
253             model_name='image',
254             name='stage',
255             field=models.ForeignKey(verbose_name='stage', blank=True, to='catalogue.ImageTag', null=True, on_delete=models.CASCADE),
256             preserve_default=True,
257         ),
258         migrations.AddField(
259             model_name='image',
260             name='user',
261             field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text='Work assignment.', null=True, verbose_name='user', on_delete=models.CASCADE),
262             preserve_default=True,
263         ),
264         migrations.AddField(
265             model_name='chunkchange',
266             name='tags',
267             field=models.ManyToManyField(related_name='change_set', verbose_name='tags', to='catalogue.ChunkTag'),
268             preserve_default=True,
269         ),
270         migrations.AddField(
271             model_name='chunkchange',
272             name='tree',
273             field=models.ForeignKey(related_name='change_set', verbose_name='document', to='catalogue.Chunk', on_delete=models.CASCADE),
274             preserve_default=True,
275         ),
276         migrations.AlterUniqueTogether(
277             name='chunkchange',
278             unique_together=set([('tree', 'revision')]),
279         ),
280         migrations.AddField(
281             model_name='chunk',
282             name='head',
283             field=models.ForeignKey(default=None, editable=False, to='catalogue.ChunkChange', blank=True, help_text="This document's current head.", null=True, verbose_name='head', on_delete=models.CASCADE),
284             preserve_default=True,
285         ),
286         migrations.AddField(
287             model_name='chunk',
288             name='stage',
289             field=models.ForeignKey(verbose_name='stage', blank=True, to='catalogue.ChunkTag', null=True, on_delete=models.CASCADE),
290             preserve_default=True,
291         ),
292         migrations.AddField(
293             model_name='chunk',
294             name='user',
295             field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, help_text='Work assignment.', null=True, verbose_name='user', on_delete=models.CASCADE),
296             preserve_default=True,
297         ),
298         migrations.AlterUniqueTogether(
299             name='chunk',
300             unique_together=set([('book', 'number'), ('book', 'slug')]),
301         ),
302         migrations.AddField(
303             model_name='book',
304             name='dc_cover_image',
305             field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, editable=False, to='cover.Image', null=True),
306             preserve_default=True,
307         ),
308         migrations.AddField(
309             model_name='book',
310             name='parent',
311             field=models.ForeignKey(related_name='children', blank=True, editable=False, to='catalogue.Book', null=True, verbose_name='parent', on_delete=models.CASCADE),
312             preserve_default=True,
313         ),
314         migrations.AddField(
315             model_name='book',
316             name='project',
317             field=models.ForeignKey(blank=True, to='catalogue.Project', null=True, on_delete=models.CASCADE),
318             preserve_default=True,
319         ),
320         migrations.CreateModel(
321             name='User',
322             fields=[
323             ],
324             options={
325                 'proxy': True,
326             },
327             bases=('auth.user',),
328         ),
329     ]