forked from mirrors/bookwyrm
Merge pull request #2036 from bookwyrm-social/author-performance
Simplifies query possibly causing author page performance issues
This commit is contained in:
commit
20e71dc0cd
1 changed files with 1 additions and 2 deletions
|
@ -1,7 +1,6 @@
|
||||||
""" the good people stuff! the authors! """
|
""" the good people stuff! the authors! """
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
from django.db.models import Q
|
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
@ -27,7 +26,7 @@ class Author(View):
|
||||||
return ActivitypubResponse(author.to_activity())
|
return ActivitypubResponse(author.to_activity())
|
||||||
|
|
||||||
books = (
|
books = (
|
||||||
models.Work.objects.filter(Q(authors=author) | Q(editions__authors=author))
|
models.Work.objects.filter(editions__authors=author)
|
||||||
.order_by("created_date")
|
.order_by("created_date")
|
||||||
.distinct()
|
.distinct()
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue