1 from celery.task import task
2 from django.utils import translation
5 @task(ignore_result=True)
6 def _refresh_by_pk(cls, pk, language=None):
7 prev_language = translation.get_language()
8 language and translation.activate(language)
10 cls._default_manager.get(pk=pk).refresh()
12 translation.activate(prev_language)
14 def refresh_instance(instance):
15 _refresh_by_pk.delay(type(instance), instance.pk, translation.get_language())
18 @task(ignore_result=True)
19 def book_content_updated(book):
20 book.refresh_dc_cache()