0001_initial.py 5.25 KB
Newer Older
Skia's avatar
Skia committed
1
2
3
4
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
Skia's avatar
Skia committed
5
from django.conf import settings
Skia's avatar
Skia committed
6
7
import datetime
import django.db.models.deletion
Skia's avatar
Skia committed
8
9
10
11
12


class Migration(migrations.Migration):

    dependencies = [
Sli's avatar
Sli committed
13
        ("club", "0007_auto_20170324_0917"),
Skia's avatar
Skia committed
14
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
Skia's avatar
Skia committed
15
16
17
18
    ]

    operations = [
        migrations.CreateModel(
Sli's avatar
Sli committed
19
            name="Trombi",
Skia's avatar
Skia committed
20
            fields=[
Sli's avatar
Sli committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
                (
                    "id",
                    models.AutoField(
                        serialize=False,
                        auto_created=True,
                        verbose_name="ID",
                        primary_key=True,
                    ),
                ),
                (
                    "subscription_deadline",
                    models.DateField(
                        default=datetime.date.today,
                        help_text="Before this date, users are allowed to subscribe to this Trombi. After this date, users subscribed will be allowed to comment on each other.",
                        verbose_name="subscription deadline",
                    ),
                ),
                (
                    "comments_deadline",
                    models.DateField(
                        default=datetime.date.today,
                        help_text="After this date, users won't be able to make comments anymore.",
                        verbose_name="comments deadline",
                    ),
                ),
                (
                    "max_chars",
                    models.IntegerField(
                        default=400,
                        help_text="Maximum number of characters allowed in a comment.",
                        verbose_name="maximum characters",
                    ),
                ),
54
55
56
57
58
59
60
61
                (
                    "club",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="club.Club",
                        related_name="trombi",
                    ),
                ),
Skia's avatar
Skia committed
62
63
64
            ],
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
65
            name="TrombiComment",
Skia's avatar
Skia committed
66
            fields=[
Sli's avatar
Sli committed
67
68
69
70
71
72
73
74
75
76
                (
                    "id",
                    models.AutoField(
                        serialize=False,
                        auto_created=True,
                        verbose_name="ID",
                        primary_key=True,
                    ),
                ),
                ("content", models.TextField(default="", verbose_name="content")),
Skia's avatar
Skia committed
77
78
79
            ],
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
80
            name="TrombiUser",
Skia's avatar
Skia committed
81
            fields=[
Sli's avatar
Sli committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
                (
                    "id",
                    models.AutoField(
                        serialize=False,
                        auto_created=True,
                        verbose_name="ID",
                        primary_key=True,
                    ),
                ),
                (
                    "profile_pict",
                    models.ImageField(
                        upload_to="trombi",
                        blank=True,
                        help_text="The profile picture you want in the trombi (warning: this picture may be published)",
                        verbose_name="profile pict",
                        null=True,
                    ),
                ),
                (
                    "scrub_pict",
                    models.ImageField(
                        upload_to="trombi",
                        blank=True,
                        help_text="The scrub picture you want in the trombi (warning: this picture may be published)",
                        verbose_name="scrub pict",
                        null=True,
                    ),
                ),
                (
                    "trombi",
                    models.ForeignKey(
                        to="trombi.Trombi",
                        blank=True,
                        verbose_name="trombi",
                        related_name="users",
                        on_delete=django.db.models.deletion.SET_NULL,
                        null=True,
                    ),
                ),
                (
                    "user",
                    models.OneToOneField(
125
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
126
127
128
129
130
                        verbose_name="trombi user",
                        to=settings.AUTH_USER_MODEL,
                        related_name="trombi_user",
                    ),
                ),
Skia's avatar
Skia committed
131
132
133
            ],
        ),
        migrations.AddField(
Sli's avatar
Sli committed
134
135
136
            model_name="trombicomment",
            name="author",
            field=models.ForeignKey(
137
                on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
138
139
140
141
                to="trombi.TrombiUser",
                verbose_name="author",
                related_name="given_comments",
            ),
Skia's avatar
Skia committed
142
143
        ),
        migrations.AddField(
Sli's avatar
Sli committed
144
145
146
            model_name="trombicomment",
            name="target",
            field=models.ForeignKey(
147
                on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
148
149
150
151
                to="trombi.TrombiUser",
                verbose_name="target",
                related_name="received_comments",
            ),
Skia's avatar
Skia committed
152
153
        ),
    ]