Skip to content

Commit 4823455

Browse files
committed
squash gallery migrations
1 parent 33f9192 commit 4823455

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Generated by Django 5.1.5 on 2025-06-03 10:59
2+
3+
import django.db.models.deletion
4+
import django_countries.fields
5+
from django.db import migrations, models
6+
7+
import gallery.models
8+
9+
10+
class Migration(migrations.Migration):
11+
replaces = [
12+
("gallery", "0001_initial"),
13+
("gallery", "0002_photo_image_height_photo_image_width_and_more"),
14+
("gallery", "0003_photo_taken_at"),
15+
("gallery", "0004_alter_photo_image"),
16+
]
17+
18+
initial = True
19+
20+
dependencies = [
21+
("competitions", "0028_rename_categorycompetition_category_and_more"),
22+
]
23+
24+
operations = [
25+
migrations.CreateModel(
26+
name="Album",
27+
fields=[
28+
(
29+
"id",
30+
models.BigAutoField(
31+
auto_created=True,
32+
primary_key=True,
33+
serialize=False,
34+
verbose_name="ID",
35+
),
36+
),
37+
("title", models.CharField(max_length=256)),
38+
("slug", models.SlugField(max_length=256)),
39+
("country", django_countries.fields.CountryField(max_length=2)),
40+
(
41+
"competition",
42+
models.ForeignKey(
43+
on_delete=django.db.models.deletion.CASCADE,
44+
related_name="albums",
45+
to="competitions.competition",
46+
),
47+
),
48+
],
49+
options={
50+
"ordering": ["country", "title"],
51+
},
52+
),
53+
migrations.CreateModel(
54+
name="Photo",
55+
fields=[
56+
(
57+
"id",
58+
models.BigAutoField(
59+
auto_created=True,
60+
primary_key=True,
61+
serialize=False,
62+
verbose_name="ID",
63+
),
64+
),
65+
(
66+
"image",
67+
models.ImageField(
68+
height_field="image_height",
69+
upload_to=gallery.models.photo_upload_to,
70+
width_field="image_width",
71+
),
72+
),
73+
(
74+
"album",
75+
models.ForeignKey(
76+
on_delete=django.db.models.deletion.CASCADE,
77+
related_name="photos",
78+
to="gallery.album",
79+
),
80+
),
81+
(
82+
"image_width",
83+
models.PositiveIntegerField(),
84+
),
85+
(
86+
"image_height",
87+
models.PositiveIntegerField(),
88+
),
89+
(
90+
"taken_at",
91+
models.DateTimeField(blank=True, null=True),
92+
),
93+
],
94+
),
95+
migrations.AddConstraint(
96+
model_name="album",
97+
constraint=models.UniqueConstraint(
98+
models.F("slug"),
99+
models.F("competition"),
100+
name="album__slug_competition",
101+
),
102+
),
103+
]

0 commit comments

Comments
 (0)