Change photo slug to filename
This commit is contained in:
parent
bac62c6d6d
commit
26a12450f4
4 changed files with 43 additions and 48 deletions
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 5.1.7 on 2025-03-28 19:11
|
||||
# Generated by Django 5.1.7 on 2025-03-31 18:01
|
||||
|
||||
import datetime
|
||||
import django.db.models.deletion
|
||||
|
@ -56,7 +56,7 @@ class Migration(migrations.Migration):
|
|||
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, unique=True, verbose_name='Photo Slug')),
|
||||
('slug', models.CharField(max_length=50, verbose_name='Photo Slug')),
|
||||
('photo', models.ImageField(height_field='height', upload_to=gallery.models.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')),
|
||||
|
@ -70,6 +70,7 @@ class Migration(migrations.Migration):
|
|||
options={
|
||||
'verbose_name_plural': 'Photos',
|
||||
'ordering': ('-taken_at',),
|
||||
'unique_together': {('album', 'slug')},
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
|
@ -88,8 +89,4 @@ class Migration(migrations.Migration):
|
|||
'verbose_name_plural': 'Redirs',
|
||||
},
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='photo',
|
||||
constraint=models.UniqueConstraint(fields=('slug',), name='unique_photo_slug'),
|
||||
),
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue