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