Files
kennethreitz 9507fe901c Add photo manager, folder importer, Postgres Celery broker, UI polish
- Photo manager (/manage/) with multi-select, bulk visibility/delete,
  faceted filtering by camera/lens/year, add-to-collection with inline
  creation
- import_folder management command with concurrent workers
- Use Postgres as Celery broker in production (no Redis needed on Fly)
- Add Celery worker process to fly.toml
- Thread fallback for image processing when Celery unavailable
- Collection list with image preview cards
- CSS cache-busting via content hash
- Fix empty UUID validation errors in bulk actions
- Makefile: remove redis start/stop (now a brew service)
- Switch to ManifestStaticFilesStorage for production

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 15:02:49 -04:00

48 lines
1.5 KiB
Python

from django.db.models import Count
from django.shortcuts import get_object_or_404, render
from core.models import Image
from gallery.models import Collection
def collection_list(request):
collections = (
Collection.objects.filter(visibility=Image.Visibility.PUBLIC)
.select_related('cover_image')
.annotate(image_count=Count('collection_images'))
.order_by('-created_at')
)
# For collections without a cover_image, grab the first image
for col in collections:
if not col.cover_image:
first = (
Image.objects.filter(
collection_entries__collection=col,
is_processing=False,
)
.order_by('collection_entries__sort_order')
.first()
)
col.preview = first
else:
col.preview = col.cover_image
return render(request, 'gallery/collection_list.html', {
'collections': collections,
})
def collection_detail(request, slug):
collection = get_object_or_404(Collection, slug=slug)
images = (
Image.objects.filter(
collection_entries__collection=collection, is_processing=False
)
.select_related('exif', 'exif__camera', 'exif__lens')
.order_by('collection_entries__sort_order')
)
return render(request, 'gallery/collection_detail.html', {
'collection': collection,
'images': images,
})