0001_initial.py 6.18 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
5
import django.db.models.deletion
Skia's avatar
Skia committed
6
7
8
9


class Migration(migrations.Migration):

Sli's avatar
Sli committed
10
    dependencies = [("subscription", "0001_initial"), ("counter", "0001_initial")]
Skia's avatar
Skia committed
11
12
13

    operations = [
        migrations.CreateModel(
Sli's avatar
Sli committed
14
            name="Launderette",
Skia's avatar
Skia committed
15
            fields=[
Sli's avatar
Sli committed
16
17
18
19
20
21
22
23
24
25
26
27
28
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=30, verbose_name="name")),
                (
                    "counter",
                    models.OneToOneField(
29
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
30
31
32
33
34
                        related_name="launderette",
                        verbose_name="counter",
                        to="counter.Counter",
                    ),
                ),
Skia's avatar
Skia committed
35
            ],
Sli's avatar
Sli committed
36
            options={"verbose_name": "Launderette"},
Skia's avatar
Skia committed
37
38
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
39
            name="Machine",
Skia's avatar
Skia committed
40
            fields=[
Sli's avatar
Sli committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=30, verbose_name="name")),
                (
                    "type",
                    models.CharField(
                        choices=[("WASHING", "Washing"), ("DRYING", "Drying")],
                        max_length=10,
                        verbose_name="type",
                    ),
                ),
                (
                    "is_working",
                    models.BooleanField(verbose_name="is working", default=True),
                ),
                (
                    "launderette",
                    models.ForeignKey(
66
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
67
68
69
70
71
                        verbose_name="launderette",
                        to="launderette.Launderette",
                        related_name="machines",
                    ),
                ),
Skia's avatar
Skia committed
72
            ],
Sli's avatar
Sli committed
73
            options={"verbose_name": "Machine"},
Skia's avatar
Skia committed
74
75
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
76
            name="Slot",
Skia's avatar
Skia committed
77
            fields=[
Sli's avatar
Sli committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("start_date", models.DateTimeField(verbose_name="start date")),
                (
                    "type",
                    models.CharField(
                        choices=[("WASHING", "Washing"), ("DRYING", "Drying")],
                        max_length=10,
                        verbose_name="type",
                    ),
                ),
                (
                    "machine",
                    models.ForeignKey(
99
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
100
101
102
103
104
                        verbose_name="machine",
                        to="launderette.Machine",
                        related_name="slots",
                    ),
                ),
Skia's avatar
Skia committed
105
            ],
Sli's avatar
Sli committed
106
            options={"verbose_name": "Slot", "ordering": ["start_date"]},
Skia's avatar
Skia committed
107
108
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
109
            name="Token",
Skia's avatar
Skia committed
110
            fields=[
Sli's avatar
Sli committed
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
                (
                    "id",
                    models.AutoField(
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=5, verbose_name="name")),
                (
                    "type",
                    models.CharField(
                        choices=[("WASHING", "Washing"), ("DRYING", "Drying")],
                        max_length=10,
                        verbose_name="type",
                    ),
                ),
                (
                    "borrow_date",
                    models.DateTimeField(
                        null=True, verbose_name="borrow date", blank=True
                    ),
                ),
                (
                    "launderette",
                    models.ForeignKey(
138
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
139
140
141
142
143
144
145
146
                        verbose_name="launderette",
                        to="launderette.Launderette",
                        related_name="tokens",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
147
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
148
149
150
151
152
153
154
                        null=True,
                        related_name="tokens",
                        verbose_name="user",
                        to="core.User",
                        blank=True,
                    ),
                ),
Skia's avatar
Skia committed
155
            ],
Sli's avatar
Sli committed
156
            options={"verbose_name": "Token", "ordering": ["type", "name"]},
Skia's avatar
Skia committed
157
        ),
158
        migrations.AddField(
Sli's avatar
Sli committed
159
160
161
            model_name="slot",
            name="token",
            field=models.ForeignKey(
162
                on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
163
164
165
166
167
168
                null=True,
                related_name="slots",
                verbose_name="token",
                to="launderette.Token",
                blank=True,
            ),
169
170
        ),
        migrations.AddField(
Sli's avatar
Sli committed
171
172
173
            model_name="slot",
            name="user",
            field=models.ForeignKey(
174
175
176
177
                on_delete=django.db.models.deletion.CASCADE,
                verbose_name="user",
                to="core.User",
                related_name="slots",
Sli's avatar
Sli committed
178
            ),
179
180
        ),
        migrations.AlterUniqueTogether(
Sli's avatar
Sli committed
181
            name="token", unique_together=set([("name", "launderette", "type")])
182
        ),
Skia's avatar
Skia committed
183
    ]