mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-30 05:21:08 +00:00
Don't try to clear caches for nonexistant authors
This commit is contained in:
parent
b0fef8f0e3
commit
0f37e0ad42
1 changed files with 6 additions and 6 deletions
|
@ -39,12 +39,12 @@ class Author(BookDataModel):
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
"""clear related template caches"""
|
"""clear related template caches"""
|
||||||
# clear template caches
|
# clear template caches
|
||||||
|
if self.id:
|
||||||
cache_keys = [
|
cache_keys = [
|
||||||
make_template_fragment_key("titleby", [book])
|
make_template_fragment_key("titleby", [book])
|
||||||
for book in self.book_set.values_list("id", flat=True)
|
for book in self.book_set.values_list("id", flat=True)
|
||||||
]
|
]
|
||||||
cache.delete_many(cache_keys)
|
cache.delete_many(cache_keys)
|
||||||
|
|
||||||
return super().save(*args, **kwargs)
|
return super().save(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in a new issue