Add justified photo grid layout with lazy loading and image dimensions.

This commit is contained in:
krek0 2026-04-24 21:43:25 +02:00
parent 3efa217716
commit 931c264a44
6 changed files with 179 additions and 4 deletions

View file

@ -0,0 +1,31 @@
from django.db import migrations
def regen_thumbnails(apps, schema_editor):
Photo = apps.get_model("photologue", "Photo")
PhotoSize = apps.get_model("photologue", "PhotoSize")
try:
thumbnail = PhotoSize.objects.get(name="thumbnail")
except PhotoSize.DoesNotExist:
return
for photo in Photo.objects.all():
# Use the real model instance to access file methods
from photologue.models import Photo as RealPhoto
try:
real_photo = RealPhoto.objects.get(pk=photo.pk)
real_photo.remove_size(thumbnail)
except Exception:
pass
class Migration(migrations.Migration):
dependencies = [
("photologue", "0008_photo_dimensions"),
]
operations = [
migrations.RunPython(regen_thumbnails, migrations.RunPython.noop),
]