80 lines
4.2 KiB
Python
80 lines
4.2 KiB
Python
# Generated by Django 5.1.4 on 2025-01-18 07:39
|
|
|
|
import datetime
|
|
import django.db.models.deletion
|
|
import gallery.models.photo
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='City',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=150, unique=True, verbose_name='City')),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'Cities',
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Location',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('place', models.CharField(blank=True, max_length=250, verbose_name='Place')),
|
|
('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='places', to='gallery.city', verbose_name='City')),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'Locations',
|
|
'unique_together': {('place', 'city')},
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Album',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=150, unique=True, verbose_name='Album')),
|
|
('slug', models.SlugField(max_length=150, unique=True, verbose_name='Slug')),
|
|
('album_date', models.DateField(default=datetime.datetime.now, verbose_name='Album Date')),
|
|
('is_public', models.BooleanField(default=False, verbose_name='Published')),
|
|
('parent', models.ForeignKey(blank=True, limit_choices_to={'parent__isnull': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='gallery.album', verbose_name='Parent Album')),
|
|
('location', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='albums', to='gallery.location', verbose_name='Location')),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'Albums',
|
|
'ordering': ('album_date',),
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Photo',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('slug', models.CharField(editable=False, max_length=15, verbose_name='Photo Slug')),
|
|
('photo', models.ImageField(height_field='height', upload_to=gallery.models.photo.Photo._get_upload_path, verbose_name='Photo', width_field='width')),
|
|
('width', models.PositiveIntegerField(default=0, editable=False, verbose_name='Photo Width')),
|
|
('height', models.PositiveIntegerField(default=0, editable=False, verbose_name='Photo Height')),
|
|
('taken_at', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='Taken at')),
|
|
('exif', models.JSONField(blank=True, editable=False, null=True, verbose_name='Exif Metadata')),
|
|
('is_favorite', models.BooleanField(default=False, verbose_name='Is Favorite')),
|
|
('views', models.PositiveIntegerField(default=0, verbose_name='Views')),
|
|
('likes', models.PositiveIntegerField(default=0, verbose_name='Likes')),
|
|
('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='photos', to='gallery.album', verbose_name='Album')),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'Photos',
|
|
'ordering': ('-taken_at',),
|
|
},
|
|
),
|
|
migrations.AddField(
|
|
model_name='album',
|
|
name='cover',
|
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='cover_to', to='gallery.photo', verbose_name='Album cover'),
|
|
),
|
|
]
|