Skip to content

Commit 9eadbd0

Browse files
🗃️ [#4486] Squash products app migrations
1 parent c2ff114 commit 9eadbd0

File tree

2 files changed

+85
-12
lines changed

2 files changed

+85
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Generated by Django 4.2.11 on 2024-07-04 14:19
2+
3+
import uuid
4+
from decimal import Decimal
5+
6+
import django.core.validators
7+
from django.db import migrations, models
8+
9+
import tinymce.models
10+
11+
import csp_post_processor.fields
12+
13+
14+
class Migration(migrations.Migration):
15+
16+
replaces = [
17+
("products", "0001_initial"),
18+
("products", "0002_auto_20210521_1352"),
19+
("products", "0003_auto_20210816_1635"),
20+
("products", "0004_set_product_uuid"),
21+
("products", "0005_auto_20210816_1639"),
22+
("products", "0006_product_information"),
23+
("products", "0007_auto_20220201_1213"),
24+
("products", "0008_alter_product_price"),
25+
]
26+
27+
initial = True
28+
29+
dependencies = []
30+
31+
operations = [
32+
migrations.CreateModel(
33+
name="Product",
34+
fields=[
35+
(
36+
"id",
37+
models.AutoField(
38+
auto_created=True,
39+
primary_key=True,
40+
serialize=False,
41+
verbose_name="ID",
42+
),
43+
),
44+
("name", models.CharField(max_length=50, verbose_name="name")),
45+
(
46+
"price",
47+
models.DecimalField(
48+
decimal_places=2,
49+
max_digits=10,
50+
validators=[
51+
django.core.validators.MinValueValidator(Decimal("0.01"))
52+
],
53+
verbose_name="price",
54+
),
55+
),
56+
(
57+
"uuid",
58+
models.UUIDField(
59+
default=uuid.uuid4,
60+
help_text="Globally unique identifier",
61+
unique=True,
62+
verbose_name="UUID",
63+
),
64+
),
65+
(
66+
"information",
67+
csp_post_processor.fields.CSPPostProcessedWYSIWYGField(
68+
base_field=tinymce.models.HTMLField(
69+
blank=True,
70+
help_text="Information text to be displayed in the confirmation page and confirmation email.",
71+
verbose_name="information",
72+
),
73+
blank=True,
74+
help_text="Information text to be displayed in the confirmation page and confirmation email.",
75+
verbose_name="information",
76+
),
77+
),
78+
],
79+
options={
80+
"verbose_name": "Product",
81+
"verbose_name_plural": "Products",
82+
},
83+
),
84+
]
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
# Generated by Django 2.2.24 on 2021-08-16 14:35
2-
import uuid
3-
42
from django.db import migrations
53

64

7-
def set_uuid(apps, _):
8-
Product = apps.get_model("products", "Product")
9-
for product in Product.objects.all():
10-
product.uuid = uuid.uuid4()
11-
product.save()
12-
13-
145
class Migration(migrations.Migration):
156

167
dependencies = [
178
("products", "0003_auto_20210816_1635"),
189
]
1910

20-
operations = [
21-
migrations.RunPython(set_uuid, migrations.RunPython.noop),
22-
]
11+
operations = []

0 commit comments

Comments
 (0)