Cache query for author's books
This commit is contained in:
parent
8e1352fb75
commit
4cc35ba25e
2 changed files with 21 additions and 5 deletions
|
@ -342,6 +342,11 @@ class Edition(Book):
|
|||
# set rank
|
||||
self.edition_rank = self.get_rank()
|
||||
|
||||
# clear author cache
|
||||
if self.id:
|
||||
for author_id in self.authors.values_list("id", flat=True):
|
||||
cache.delete(f"author-books-{author_id}")
|
||||
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue