educational levels in catalogue pdf
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 21 Nov 2011 10:02:01 +0000 (11:02 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 21 Nov 2011 10:02:01 +0000 (11:02 +0100)
apps/catalogue/models.py
apps/catalogue/templatetags/catalogue_tags.py
apps/reporting/templates/reporting/catalogue.texml
lib/librarian

index 22ed325..c420119 100644 (file)
@@ -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))
index e6544b0..7667621 100644 (file)
@@ -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("""
             <cmd name='hspace'><parm>%(depth)dem</parm></cmd>%(title)s
+            <spec cat='align' /><cmd name="note"><parm>%(audiences)s</parm></cmd>
             <spec cat='align' /><cmd name="note"><parm>%(audiobook)s</parm></cmd>
             <ctrl ch='\\' />
             %(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)
index 93a13d0..c17ed07 100755 (executable)
@@ -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}}
 
         <TeXML escape="1">
             {% book_tree_texml orphans books_by_parent %}
index 84ec0eb..6798a1e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 84ec0eba63d0933b3f22a7884c46be6b796ee165
+Subproject commit 6798a1eb468cd86db145323c446f5fa1e89daaca