X-Git-Url: https://git.sommitrealweird.co.uk/sommitrealweird.git/blobdiff_plain/4c8cb8b77590e3bbccb1fdf8dc05094b683a5a14..075239c730821f8acd231cd25987bb1c16031421:/sommitrealweird/photo/views.py?ds=sidebyside 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