From: Radek Czajka Date: Fri, 30 Dec 2011 08:45:20 +0000 (+0100) Subject: Merge branch 'pretty' of github.com:fnp/wolnelektury into pretty X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d52c76021eaf1621b4e55a6eba1df1c0404bd7dd?ds=inline;hp=--cc Merge branch 'pretty' of github.com:fnp/wolnelektury into pretty Conflicts: apps/catalogue/management/commands/importbooks.py wolnelektury/templates/catalogue/book_detail.html wolnelektury/templates/catalogue/book_short.html --- d52c76021eaf1621b4e55a6eba1df1c0404bd7dd diff --cc apps/catalogue/management/commands/importbooks.py index 995132a82,b6ddc5540..5b4d499a4 --- a/apps/catalogue/management/commands/importbooks.py +++ b/apps/catalogue/management/commands/importbooks.py @@@ -42,10 -43,12 +43,11 @@@ class Command(BaseCommand) verbose = options.get('verbose') file_base, ext = os.path.splitext(file_path) book = Book.from_xml_file(file_path, overwrite=options.get('force'), - build_epub=options.get('build_epub'), - build_txt=options.get('build_txt'), - build_pdf=options.get('build_pdf'), - build_mobi=options.get('build_mobi')) + build_epub=options.get('build_epub'), + build_txt=options.get('build_txt'), + build_pdf=options.get('build_pdf'), + build_mobi=options.get('build_mobi'), + search_index=options.get('search_index')) - fileid = book.fileid() for ebook_format in Book.ebook_formats: if os.path.isfile(file_base + '.' + ebook_format): getattr(book, '%s_file' % ebook_format).save( diff --cc apps/catalogue/models.py index 43a9496d8,77efe6e98..78e6b0b3d --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@@ -686,9 -724,22 +684,22 @@@ class Book(models.Model) def zip_audiobooks(self, format_): bm = BookMedia.objects.filter(book=self, type=format_) paths = map(lambda bm: (None, bm.file.path), bm) - result = create_zip.delay(paths, "%s_%s" % (self.fileid(), format_)) + result = create_zip.delay(paths, "%s_%s" % (self.slug, format_)) return result.wait() + def search_index(self, book_info=None): + if settings.CELERY_ALWAYS_EAGER: + idx = search.ReusableIndex() + else: + idx = search.Index() + + idx.open() + try: + idx.index_book(self, book_info) + idx.index_tags() + finally: + idx.close() + @classmethod def from_xml_file(cls, xml_file, **kwargs): from django.core.files import File diff --cc wolnelektury/templates/catalogue/book_detail.html index 62b16f242,0a8b2236c..5645f68ec --- a/wolnelektury/templates/catalogue/book_detail.html +++ b/wolnelektury/templates/catalogue/book_detail.html @@@ -9,135 -9,8 +9,7 @@@ {% block bodyid %}book-detail{% endblock %} {% block body %} -

{% book_title book %}

-
- + {% book_wide book %} - {% if extra_info.license %} -

{% trans "Work is licensed under " %} {{ extra_info.license_description }}.

- {% endif %} -

{% trans "Based on" %}: {{ extra_info.source_name }}

- {% if book.has_description %} -
-
{{ book.description|safe }}
-
{{ book.description|safe|truncatewords_html:30 }}
-
-

- {% endif %} -
-

{% trans "Put a book" %} {% trans "on the shelf!" %}

-
-
- {% if book.has_html_file %} - {% trans "Read online" %} - {% endif %} -
- {% if book.pdf_file %} - {% trans - {% endif %} - {% if book.epub_file %} - {% trans - {% endif %} - {% if book.mobi_file %} - {% trans - {% endif %} - {% if book.txt_file %} - {% trans - {% endif %} - - {% if book.pdf_file %} -
{% trans "Dowload customized PDF" %}. - {% endif %} - -
-
-
- - {% if book_children %} - {% autopaginate book_children 10 %} -
-
    - {% for book in book_children %} -
  1. {{ book.short_html }}
  2. - {% endfor %} -
-
- {% paginate %} - {% endif %} - -
-- -
-
-

{% trans "Details" %}

-
    -
  • - {% trans "Author" %}: - {% for tag in categories.author %} - {{ tag }}{% if not forloop.last %}, {% endif %} - {% endfor %} -
  • -
  • - {% trans "Epoch" %}: - {% for tag in categories.epoch %} - {{ tag }}{% if not forloop.last %}, {% endif %} - {% endfor %} -
  • -
  • - {% trans "Kind" %}: - {% for tag in categories.kind %} - {{ tag }}{% if not forloop.last %}, {% endif %} - {% endfor %} -
  • -
  • - {% trans "Genre" %}: - {% for tag in categories.genre %} - {{ tag }}{% if not forloop.last %}, {% endif %} - {% endfor %} -
  • -
-

{% trans "Other resources" %}

- -

{% trans "View XML source" %}

-

Miksuj ten utwór

-
-
-

{% trans "Work's themes " %}

- -
-
-
{% endblock %} diff --cc wolnelektury/templates/catalogue/book_short.html index 9800a0cae,1c3a74253..7f262374d --- a/wolnelektury/templates/catalogue/book_short.html +++ b/wolnelektury/templates/catalogue/book_short.html @@@ -49,7 -51,7 +51,7 @@@