Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
MaertHaekkinen committed Oct 23, 2024
1 parent 115babe commit 7455da5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ajapaik/ajapaik/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,13 +975,19 @@ def photo_slug(request, photo_id=None, pseudo_slug=None):
AlbumPhoto.objects.filter(photo_id__gt=photo_obj.pk, album=album.id).aggregate(min_id=Min('photo_id'))[
'min_id']
if next_photo_id:
next_photo = Photo.objects.get(pk=next_photo_id)
try:
next_photo = Photo.objects.get(pk=next_photo_id)
except Exception as e:
raise Exception(f"Matching query does not exist {next_photo_id}")

previous_photo_id = \
AlbumPhoto.objects.filter(photo_id__lt=photo_obj.pk, album=album.id).aggregate(max_id=Max('photo_id'))[
'max_id']
if previous_photo_id:
previous_photo = Photo.objects.get(pk=previous_photo_id)
try:
previous_photo = Photo.objects.get(pk=previous_photo_id)
except Exception as e:
raise Exception(f"Matching query does not exist {next_photo_id}")
else:
album_selection_form = AlbumSelectionForm(
initial={'album': Album.objects.filter(is_public=True).order_by('-created').first()}
Expand Down

0 comments on commit 7455da5

Please sign in to comment.