From 94f422ac82d9af46410c63775e4aeea77395a730 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 29 Dec 2011 10:03:55 +0100 Subject: [PATCH] fixes --- apps/catalogue/models/book.py | 2 ++ apps/catalogue/tasks.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 772b1217..4fbd194f 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -271,6 +271,8 @@ class Book(models.Model): def get_on_track(self): if self.published: return -1 + if len(self) == 0: + return -1 return min(ch.stage.ordering for ch in self) or 0 on_track = cached_in_field('_on_track')(get_on_track) diff --git a/apps/catalogue/tasks.py b/apps/catalogue/tasks.py index 547f36b4..c84a2912 100644 --- a/apps/catalogue/tasks.py +++ b/apps/catalogue/tasks.py @@ -3,7 +3,7 @@ from django.utils import translation from django.conf import settings -@task +@task(ignore_result=True) def _refresh_by_pk(cls, pk, language=None): prev_language = translation.get_language() language and translation.activate(language) @@ -34,6 +34,6 @@ def publishable_error(book): translation.get_language()).wait() -@task +@task(ignore_result=True) def book_content_updated(book): book.refresh_dc_cache() -- 2.20.1