forked from mirrors/bookwyrm
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
|
||||||
cache_keys = [
|
if self.id:
|
||||||
make_template_fragment_key("titleby", [book])
|
cache_keys = [
|
||||||
for book in self.book_set.values_list("id", flat=True)
|
make_template_fragment_key("titleby", [book])
|
||||||
]
|
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