Case insensitive album slug

This commit is contained in:
Nyymix 2025-05-16 21:53:15 +03:00
parent 01dec1e140
commit eeff75a3e9

View file

@ -53,7 +53,8 @@ class PhotoDetail(DetailView):
def get_object(self, queryset=None):
album_slug = self.kwargs.get('album_slug')
photo_slug = self.kwargs.get('photo_slug')
photo = get_object_or_404(Photo.objects.select_related('album'), slug=photo_slug, album__slug=album_slug)
# photo = get_object_or_404(Photo.objects.select_related('album'), slug=photo_slug, album__slug=album_slug)
photo = get_object_or_404(Photo.objects.select_related('album'), slug=photo_slug, album__slug__iexact=album_slug)
if photo.slug not in self.request.session:
photo.add_view()