X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/40a993399c67ca16752f44b8c60c41b8e8df838f..d5ffd31f4dca5ab0144fae542e048934bafa7110:/apps/catalogue/models/book.py diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 7589587d..c8792bbf 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -92,10 +92,10 @@ class Book(models.Model): @classmethod @transaction.commit_on_success - def create(cls, creator, text, **kwargs): + def create(cls, creator, text, commit_args=None, **kwargs): b = cls.objects.create(**kwargs) b.chunk_set.all().update(creator=creator) - b[0].commit(text, author=creator) + b[0].commit(text, author=creator, **(commit_args or {})) return b def add(self, *args, **kwargs): @@ -419,8 +419,8 @@ class Book(models.Model): changes = self.get_current_changes() data = {"lesson_xml": self.wl1_xml(changes=changes)} if host: - gallery_url = u'%s%s%s%s/' % (host, settings.MEDIA_URL, settings.IMAGE_DIR, self.slug) - gallery_dir = os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, self.slug) + gallery_url = u'%s%s%s%s/' % (host, settings.MEDIA_URL, settings.IMAGE_DIR, self.gallery) + gallery_dir = os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, self.gallery) if os.path.isdir(gallery_dir): data['gallery_url'] = gallery_url attachments = os.listdir(gallery_dir)