1
0
Fork 0

Only show editions with the author on the author page

This commit is contained in:
Mouse Reeve 2022-11-01 18:04:27 -07:00
parent 43202f5bb7
commit 553f170f89
3 changed files with 12 additions and 1 deletions

View file

@ -241,6 +241,10 @@ class Work(OrderedCollectionPageMixin, Book):
"""in case the default edition is not set"""
return self.editions.order_by("-edition_rank").first()
def author_edition(self, author):
"""in case the default edition doesn't have the required author"""
return self.editions.filter(authors=author).order_by("-edition_rank").first()
def to_edition_list(self, **kwargs):
"""an ordered collection of editions"""
return self.to_ordered_collection(