From a584f077b72f75804e16786c30f8496d578a0c18 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 17 Mar 2022 09:51:54 -0700 Subject: [PATCH] Simplifies query likely causing author page performance issues --- bookwyrm/views/author.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bookwyrm/views/author.py b/bookwyrm/views/author.py index 54eadef6..47845ab6 100644 --- a/bookwyrm/views/author.py +++ b/bookwyrm/views/author.py @@ -1,7 +1,6 @@ """ the good people stuff! the authors! """ from django.contrib.auth.decorators import login_required, permission_required from django.core.paginator import Paginator -from django.db.models import Q from django.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse from django.utils.decorators import method_decorator @@ -27,7 +26,7 @@ class Author(View): return ActivitypubResponse(author.to_activity()) books = ( - models.Work.objects.filter(Q(authors=author) | Q(editions__authors=author)) + models.Work.objects.filter(editions__authors=author) .order_by("created_date") .distinct() )