Small efficiency improvement in list view

This commit is contained in:
Mouse Reeve 2021-08-21 20:21:39 -07:00
parent e76163ffae
commit 7345705b08

View file

@ -116,7 +116,7 @@ class List(View):
if direction == "descending":
directional_sort_by = "-" + directional_sort_by
items = book_list.listitem_set
items = book_list.listitem_set.prefetch_related("user", "book", "book__authors")
if sort_by == "rating":
items = items.annotate(
average_rating=Avg(