X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1c4c468783e5f380324c29ebc3b2c452da8cc2a0..633c738404af70bacebd4bda52cf328803fe73ed:/apps/catalogue/models/book.py diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 6f47642c..45726551 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -365,10 +365,10 @@ class Book(models.Model): def refresh(self): """This should be done offline.""" - self.short_html() - self.single() - self.new_publishable() - self.published() + self.short_html + self.single + self.new_publishable + self.published # Materializing & publishing # ========================== @@ -423,7 +423,10 @@ class Book(models.Model): gallery_dir = os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, self.slug) if os.path.isdir(gallery_dir): data['gallery_url'] = gallery_url - data['attachments'] = json.dumps(os.listdir(gallery_dir)) + attachments = os.listdir(gallery_dir) + else: + attachments = [] + data['attachments'] = json.dumps(attachments) apiclient.api_call(user, "lessons/", data) # record the publish br = BookPublishRecord.objects.create(book=self, user=user)