X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e01dee1eda68946acf73e43f2c54b3c730514a21..0a08ba4250b13d7804118703aa0acca6a1a1703c:/apps/catalogue/models/book.py diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index c3c1369b..90327b26 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -9,10 +9,8 @@ from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from slughifi import slughifi -import apiclient from catalogue.helpers import cached_in_field from catalogue.models import BookPublishRecord, ChunkPublishRecord -from catalogue.signals import post_publish from catalogue.tasks import refresh_instance, book_content_updated from catalogue.xml_tools import compile_text, split_xml @@ -34,7 +32,8 @@ class Book(models.Model): _single = models.NullBooleanField(editable=False, db_index=True) _new_publishable = models.NullBooleanField(editable=False) _published = models.NullBooleanField(editable=False) - dc_slug = models.CharField(max_length=128, null=True, blank=True, editable=False) + dc_slug = models.CharField(max_length=128, null=True, blank=True, + editable=False, db_index=True) class NoTextError(BaseException): pass @@ -349,6 +348,9 @@ class Book(models.Model): """ Publishes a book on behalf of a (local) user. """ + import apiclient + from catalogue.signals import post_publish + self.assert_publishable() changes = self.get_current_changes(publishable=True) book_xml = self.materialize(changes=changes)