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