# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db import models
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db import models
# and invalidate their cached includes.
if old_name != self.name or old_netloc != self.netloc:
for book in Book.objects.all():
# and invalidate their cached includes.
if old_name != self.name or old_netloc != self.netloc:
for book in Book.objects.all():
- source = book.extra_info.get('source_url', '')
- if self.netloc in source or (old_netloc != self.netloc
- and old_netloc in source):
- book.flush_includes()
+ source = book.get_extra_info_json().get('source_url', '')
+ if self.netloc in source or (old_netloc != self.netloc and old_netloc in source):
+ book.clear_cache()