fix toc
[wolnelektury.git] / src / funding / migrations / 0001_initial.py
1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
3 #
4 from django.db import models, migrations
5 import django.db.models.deletion
6
7
8 class Migration(migrations.Migration):
9
10     dependencies = [
11         ('polls', '0001_initial'),
12         ('catalogue', '0001_initial'),
13     ]
14
15     operations = [
16         migrations.CreateModel(
17             name='Funding',
18             fields=[
19                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
20                 ('name', models.CharField(max_length=127, verbose_name='name', blank=True)),
21                 ('email', models.EmailField(db_index=True, max_length=75, verbose_name='email', blank=True)),
22                 ('amount', models.DecimalField(verbose_name='amount', max_digits=10, decimal_places=2)),
23                 ('payed_at', models.DateTimeField(db_index=True, null=True, verbose_name='payed at', blank=True)),
24                 ('language_code', models.CharField(max_length=2, null=True, blank=True)),
25                 ('notifications', models.BooleanField(default=True, db_index=True, verbose_name='notifications')),
26                 ('notify_key', models.CharField(max_length=32)),
27             ],
28             options={
29                 'ordering': ['-payed_at'],
30                 'verbose_name': 'funding',
31                 'verbose_name_plural': 'fundings',
32             },
33             bases=(models.Model,),
34         ),
35         migrations.CreateModel(
36             name='Offer',
37             fields=[
38                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
39                 ('author', models.CharField(max_length=255, verbose_name='author')),
40                 ('title', models.CharField(max_length=255, verbose_name='Title')),
41                 ('slug', models.SlugField(verbose_name='Slug')),
42                 ('description', models.TextField(verbose_name='Description', blank=True)),
43                 ('target', models.DecimalField(verbose_name='target', max_digits=10, decimal_places=2)),
44                 ('start', models.DateField(verbose_name='start', db_index=True)),
45                 ('end', models.DateField(verbose_name='end', db_index=True)),
46                 ('redakcja_url', models.URLField(verbose_name='redakcja URL', blank=True)),
47                 ('cover', models.ImageField(upload_to='funding/covers', verbose_name='Cover')),
48                 ('notified_near', models.DateTimeField(null=True, verbose_name='Near-end notifications sent', blank=True)),
49                 ('notified_end', models.DateTimeField(null=True, verbose_name='End notifications sent', blank=True)),
50                 ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, to='catalogue.Book', help_text='Published book.', null=True)),
51                 ('poll', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, to='polls.Poll', help_text='Poll', null=True)),
52             ],
53             options={
54                 'ordering': ['-end'],
55                 'verbose_name': 'offer',
56                 'verbose_name_plural': 'offers',
57             },
58             bases=(models.Model,),
59         ),
60         migrations.CreateModel(
61             name='Perk',
62             fields=[
63                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
64                 ('price', models.DecimalField(verbose_name='price', max_digits=10, decimal_places=2)),
65                 ('name', models.CharField(max_length=255, verbose_name='name')),
66                 ('long_name', models.CharField(max_length=255, verbose_name='long name')),
67                 ('end_date', models.DateField(null=True, verbose_name='end date', blank=True)),
68                 ('offer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='offer', blank=True, to='funding.Offer', null=True)),
69             ],
70             options={
71                 'ordering': ['-price'],
72                 'verbose_name': 'perk',
73                 'verbose_name_plural': 'perks',
74             },
75             bases=(models.Model,),
76         ),
77         migrations.CreateModel(
78             name='Spent',
79             fields=[
80                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
81                 ('amount', models.DecimalField(verbose_name='amount', max_digits=10, decimal_places=2)),
82                 ('timestamp', models.DateField(verbose_name='when')),
83                 ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalogue.Book')),
84             ],
85             options={
86                 'ordering': ['-timestamp'],
87                 'verbose_name': 'money spent on a book',
88                 'verbose_name_plural': 'money spent on books',
89             },
90             bases=(models.Model,),
91         ),
92         migrations.AddField(
93             model_name='funding',
94             name='offer',
95             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, verbose_name='offer', to='funding.Offer'),
96             preserve_default=True,
97         ),
98         migrations.AddField(
99             model_name='funding',
100             name='perks',
101             field=models.ManyToManyField(to='funding.Perk', verbose_name='perks', blank=True),
102             preserve_default=True,
103         ),
104     ]