X-Git-Url: https://git.sommitrealweird.co.uk/sommitrealweird.git/blobdiff_plain/2f8f1efa5214444b2e867bde2a6f5297d1f3caea..refs/heads/django-4.2:/sommitrealweird/photo/views.py diff --git a/sommitrealweird/photo/views.py b/sommitrealweird/photo/views.py index fea7dd3..bddd15d 100644 --- a/sommitrealweird/photo/views.py +++ b/sommitrealweird/photo/views.py @@ -10,12 +10,14 @@ class AlbumListView(ListView): class PhotoListView(ListView): model = Photo paginate_by = 20 - order_by = 'order, image' + + def order_by(self): + return self.ordering def get_queryset(self): try: album = Album.objects.get(slug__exact=self.kwargs['slug']) - return Photo.objects.filter(album=album) + return Photo.objects.filter(album=album).order_by('order', 'image') except: raise Http404