Files
kennethreitz 338a1e230b Add all models, README, and initial migrations
Core: User (AbstractUser + email required), Camera, Lens, Image, ExifData.
Gallery: Collection and CollectionImage.
Groups: Group, GroupMembership, GroupImage.
All models use UUID primary keys with created_at/updated_at timestamps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 19:07:37 -04:00

121 lines
3.9 KiB
Python

# Generated by Django 6.0.4 on 2026-04-07 23:07
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("core", "0001_initial"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="Collection",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("title", models.CharField(max_length=255)),
("slug", models.SlugField(max_length=255)),
("description", models.TextField(blank=True)),
(
"visibility",
models.CharField(
choices=[
("public", "Public"),
("private", "Private"),
("unlisted", "Unlisted"),
],
default="public",
max_length=10,
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"cover_image",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="core.image",
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="collections",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"ordering": ["-created_at"],
},
),
migrations.CreateModel(
name="CollectionImage",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("sort_order", models.PositiveIntegerField(default=0)),
("added_at", models.DateTimeField(auto_now_add=True)),
(
"collection",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="collection_images",
to="gallery.collection",
),
),
(
"image",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="collection_entries",
to="core.image",
),
),
],
options={
"ordering": ["sort_order"],
"unique_together": {("collection", "image")},
},
),
migrations.AddField(
model_name="collection",
name="images",
field=models.ManyToManyField(
related_name="collections",
through="gallery.CollectionImage",
to="core.image",
),
),
migrations.AlterUniqueTogether(
name="collection",
unique_together={("user", "slug")},
),
]