1dbbcc1366fae13d97ebed0436821f8bf8c1b021
[wolnelektury.git] / src / club / migrations / 0001_initial.py
1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from django.conf import settings
5 from django.db import migrations, models
6 import django.db.models.deletion
7
8
9 class Migration(migrations.Migration):
10
11     initial = True
12
13     dependencies = [
14         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15     ]
16
17     operations = [
18         migrations.CreateModel(
19             name='Membership',
20             fields=[
21                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22                 ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
23                 ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user')),
24             ],
25             options={
26                 'verbose_name': 'membership',
27                 'verbose_name_plural': 'memberships',
28             },
29         ),
30         migrations.CreateModel(
31             name='Payment',
32             fields=[
33                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
34                 ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='created at')),
35                 ('payed_at', models.DateTimeField(blank=True, null=True, verbose_name='payed at')),
36             ],
37             options={
38                 'verbose_name': 'payment',
39                 'verbose_name_plural': 'payments',
40             },
41         ),
42         migrations.CreateModel(
43             name='Plan',
44             fields=[
45                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
46                 ('interval', models.SmallIntegerField(choices=[(30, 'a month'), (365, 'a year'), (999, 'in perpetuity')], verbose_name='inteval')),
47                 ('min_amount', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='min_amount')),
48                 ('allow_recurring', models.BooleanField(verbose_name='allow recurring')),
49                 ('allow_one_time', models.BooleanField(verbose_name='allow one time')),
50             ],
51             options={
52                 'ordering': ('interval',),
53             },
54         ),
55         migrations.CreateModel(
56             name='ReminderEmail',
57             fields=[
58                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
59                 ('days_before', models.SmallIntegerField(verbose_name='days before')),
60                 ('subject', models.CharField(max_length=1024, verbose_name='subject')),
61                 ('subject_de', models.CharField(max_length=1024, null=True, verbose_name='subject')),
62                 ('subject_en', models.CharField(max_length=1024, null=True, verbose_name='subject')),
63                 ('subject_es', models.CharField(max_length=1024, null=True, verbose_name='subject')),
64                 ('subject_fr', models.CharField(max_length=1024, null=True, verbose_name='subject')),
65                 ('subject_it', models.CharField(max_length=1024, null=True, verbose_name='subject')),
66                 ('subject_lt', models.CharField(max_length=1024, null=True, verbose_name='subject')),
67                 ('subject_pl', models.CharField(max_length=1024, null=True, verbose_name='subject')),
68                 ('subject_ru', models.CharField(max_length=1024, null=True, verbose_name='subject')),
69                 ('subject_uk', models.CharField(max_length=1024, null=True, verbose_name='subject')),
70                 ('body', models.TextField(verbose_name='body')),
71                 ('body_de', models.TextField(null=True, verbose_name='body')),
72                 ('body_en', models.TextField(null=True, verbose_name='body')),
73                 ('body_es', models.TextField(null=True, verbose_name='body')),
74                 ('body_fr', models.TextField(null=True, verbose_name='body')),
75                 ('body_it', models.TextField(null=True, verbose_name='body')),
76                 ('body_lt', models.TextField(null=True, verbose_name='body')),
77                 ('body_pl', models.TextField(null=True, verbose_name='body')),
78                 ('body_ru', models.TextField(null=True, verbose_name='body')),
79                 ('body_uk', models.TextField(null=True, verbose_name='body')),
80             ],
81             options={
82                 'ordering': ['days_before'],
83                 'verbose_name': 'reminder email',
84                 'verbose_name_plural': 'reminder emails',
85             },
86         ),
87         migrations.CreateModel(
88             name='Schedule',
89             fields=[
90                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
91                 ('key', models.CharField(max_length=255, unique=True, verbose_name='key')),
92                 ('email', models.EmailField(max_length=254, verbose_name='email')),
93                 ('amount', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='amount')),
94                 ('method', models.CharField(choices=[('payu', 'PayU'), ('payu-re', 'PayU Recurring'), ('paypal-re', 'PayPal Recurring')], max_length=255, verbose_name='method')),
95                 ('is_active', models.BooleanField(default=False, verbose_name='active')),
96                 ('is_cancelled', models.BooleanField(default=False, verbose_name='cancelled')),
97                 ('started_at', models.DateTimeField(auto_now_add=True, verbose_name='started at')),
98                 ('expires_at', models.DateTimeField(blank=True, null=True, verbose_name='expires_at')),
99                 ('membership', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='club.Membership', verbose_name='membership')),
100                 ('plan', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='club.Plan', verbose_name='plan')),
101             ],
102             options={
103                 'verbose_name': 'schedule',
104                 'verbose_name_plural': 'schedules',
105             },
106         ),
107         migrations.AddField(
108             model_name='payment',
109             name='schedule',
110             field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='club.Schedule', verbose_name='schedule'),
111         ),
112     ]