X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1b6e22f8afa7a50c8f8e047ef638293b496251cb..957587c1b5fb2133d73e0397fc0bb94a3316b69d:/apps/catalogue/models/book.py?ds=sidebyside diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 4c35e689..45726551 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -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)