From: Radek Czajka Date: Mon, 21 Nov 2011 10:02:01 +0000 (+0100) Subject: educational levels in catalogue pdf X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d1988c3836976a46a953f4c076f069fda39b0a7b?ds=sidebyside educational levels in catalogue pdf --- diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 22ed32510..c420119f0 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -885,6 +885,19 @@ class Book(models.Model): return books_by_author, orphans, books_by_parent + _audiences_pl = { + "SP1": (1, u"szkoła podstawowa"), + "SP2": (1, u"szkoła podstawowa"), + "P": (1, u"szkoła podstawowa"), + "G": (2, u"gimnazjum"), + "L": (3, u"liceum"), + "LP": (3, u"liceum"), + } + def audiences_pl(self): + audiences = self.get_extra_info_value().get('audiences', []) + audiences = sorted(set([self._audiences_pl[a] for a in audiences])) + return [a[1] for a in audiences] + def _has_factory(ftype): has = lambda self: bool(getattr(self, "%s_file" % ftype)) diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py index e6544b038..7667621d6 100644 --- a/apps/catalogue/templatetags/catalogue_tags.py +++ b/apps/catalogue/templatetags/catalogue_tags.py @@ -144,12 +144,14 @@ def book_tree(book_list, books_by_parent): def book_tree_texml(book_list, books_by_parent, depth=1): return "".join(""" %(depth)dem%(title)s + %(audiences)s %(audiobook)s %(children)s """ % { "depth": depth, "title": book.title, + "audiences": ", ".join(book.audiences_pl()), "audiobook": "audiobook" if book.has_media('mp3') else "", "children": book_tree_texml(books_by_parent.get(book.id, ()), books_by_parent, depth + 1) } for book in book_list) diff --git a/apps/reporting/templates/reporting/catalogue.texml b/apps/reporting/templates/reporting/catalogue.texml index 93a13d0b2..c17ed0754 100755 --- a/apps/reporting/templates/reporting/catalogue.texml +++ b/apps/reporting/templates/reporting/catalogue.texml @@ -47,7 +47,7 @@ LetterSpace=-1.0 \setlength{\leftmargin}{0em} \setlength{\rightmargin}{0em} \setlength{\textheight}{24cm} -\setlength{\textwidth}{17cm} +\setlength{\textwidth}{17.5cm} \pagestyle{fancy} @@ -98,7 +98,7 @@ LetterSpace=-1.0 \end{flushright} \end{minipage} - \begin{longtable}{p{15cm} p{2cm}} + \begin{longtable}{p{9.5cm} p{5.5cm}r p{2cm}} {% book_tree_texml orphans books_by_parent %} diff --git a/lib/librarian b/lib/librarian index 84ec0eba6..6798a1eb4 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit 84ec0eba63d0933b3f22a7884c46be6b796ee165 +Subproject commit 6798a1eb468cd86db145323c446f5fa1e89daaca