0001_initial.py 6.35 KB
Newer Older
1
2
3
4
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
5
import django.db.models.deletion
6
7
8
9


class Migration(migrations.Migration):

Sli's avatar
Sli committed
10
    dependencies = [("counter", "0011_auto_20161004_2039")]
11
12

    operations = [
13
        migrations.CreateModel(
Sli's avatar
Sli committed
14
            name="ShoppingList",
15
            fields=[
Sli's avatar
Sli committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        primary_key=True,
                        serialize=False,
                        auto_created=True,
                    ),
                ),
                ("date", models.DateTimeField(verbose_name="date")),
                ("name", models.CharField(max_length=64, verbose_name="name")),
                ("todo", models.BooleanField(verbose_name="todo")),
                (
                    "comment",
                    models.TextField(verbose_name="comment", blank=True, null=True),
                ),
Skia's avatar
Skia committed
32
33
34
            ],
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
35
            name="ShoppingListItem",
Skia's avatar
Skia committed
36
            fields=[
Sli's avatar
Sli committed
37
38
39
40
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
66
67
68
69
70
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        primary_key=True,
                        serialize=False,
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=64, verbose_name="name")),
                (
                    "tobuy_quantity",
                    models.IntegerField(
                        verbose_name="quantity to buy",
                        help_text="quantity to buy during the next shopping session",
                        default=6,
                    ),
                ),
                (
                    "bought_quantity",
                    models.IntegerField(
                        verbose_name="quantity bought",
                        help_text="quantity bought during the last shopping session",
                        default=0,
                    ),
                ),
                (
                    "shopping_lists",
                    models.ManyToManyField(
                        verbose_name="shopping lists",
                        related_name="shopping_items_to_buy",
                        to="stock.ShoppingList",
                    ),
                ),
71
72
            ],
        ),
73
        migrations.CreateModel(
Sli's avatar
Sli committed
74
            name="Stock",
75
            fields=[
Sli's avatar
Sli committed
76
77
78
79
80
81
82
83
84
85
86
87
88
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        primary_key=True,
                        serialize=False,
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=64, verbose_name="name")),
                (
                    "counter",
                    models.OneToOneField(
89
                        on_delete=django.db.models.deletion.CASCADE,
Sli's avatar
Sli committed
90
91
92
93
94
                        verbose_name="counter",
                        related_name="stock",
                        to="counter.Counter",
                    ),
                ),
95
96
97
            ],
        ),
        migrations.CreateModel(
Sli's avatar
Sli committed
98
            name="StockItem",
99
            fields=[
Sli's avatar
Sli committed
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
125
126
127
128
129
130
131
132
133
134
135
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        primary_key=True,
                        serialize=False,
                        auto_created=True,
                    ),
                ),
                ("name", models.CharField(max_length=64, verbose_name="name")),
                (
                    "unit_quantity",
                    models.IntegerField(
                        verbose_name="unit quantity",
                        help_text="number of element in one box",
                        default=0,
                    ),
                ),
                (
                    "effective_quantity",
                    models.IntegerField(
                        verbose_name="effective quantity",
                        help_text="number of box",
                        default=0,
                    ),
                ),
                (
                    "minimal_quantity",
                    models.IntegerField(
                        verbose_name="minimal quantity",
                        help_text="if the effective quantity is less than the minimal, item is added to the shopping list",
                        default=1,
                    ),
                ),
                (
                    "stock_owner",
136
137
138
139
140
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="items",
                        to="stock.Stock",
                    ),
Sli's avatar
Sli committed
141
142
143
144
145
146
147
148
149
150
151
152
                ),
                (
                    "type",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        verbose_name="type",
                        related_name="stock_items",
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="counter.ProductType",
                    ),
                ),
153
154
            ],
        ),
155
        migrations.AddField(
Sli's avatar
Sli committed
156
157
158
            model_name="shoppinglistitem",
            name="stockitem_owner",
            field=models.ForeignKey(
159
160
161
162
                on_delete=django.db.models.deletion.CASCADE,
                null=True,
                related_name="shopping_item",
                to="stock.StockItem",
Sli's avatar
Sli committed
163
            ),
Skia's avatar
Skia committed
164
165
        ),
        migrations.AddField(
Sli's avatar
Sli committed
166
167
168
169
170
171
172
173
174
175
            model_name="shoppinglistitem",
            name="type",
            field=models.ForeignKey(
                blank=True,
                null=True,
                verbose_name="type",
                related_name="shoppinglist_items",
                on_delete=django.db.models.deletion.SET_NULL,
                to="counter.ProductType",
            ),
176
177
        ),
        migrations.AddField(
Sli's avatar
Sli committed
178
179
180
            model_name="shoppinglist",
            name="stock_owner",
            field=models.ForeignKey(
181
182
183
184
                on_delete=django.db.models.deletion.CASCADE,
                null=True,
                related_name="shopping_lists",
                to="stock.Stock",
Sli's avatar
Sli committed
185
            ),
186
        ),
187
    ]