Fix for covers generation.
[redakcja.git] / src / wlxml / views.py
index f1f5dae..8c03e05 100644 (file)
@@ -7,8 +7,8 @@ from librarian.dcparser import BookInfo
 from librarian.document import WLDocument
 from librarian.builders import StandaloneHtmlBuilder
 from librarian.meta.types.wluri import WLURI
 from librarian.document import WLDocument
 from librarian.builders import StandaloneHtmlBuilder
 from librarian.meta.types.wluri import WLURI
-from librarian.meta.types.text import LegimiCategory, Epoch, Kind, Genre, Audience, ThemaCategory
-from depot.legimi import legimi
+from librarian.meta.types.text import LegimiCategory, Epoch, Kind, Genre, Audience, ThemaCategory, MainThemaCategory
+from depot.publishers.legimi import Legimi
 
 
 class XslView(TemplateView):
 
 
 class XslView(TemplateView):
@@ -48,12 +48,28 @@ class TagView(DetailView):
 VALUE_TYPES = {
     LegimiCategory: {
         'widget': 'select',
 VALUE_TYPES = {
     LegimiCategory: {
         'widget': 'select',
-        'options': [''] + list(legimi.CATEGORIES.keys()),
+        'options': [''] + list(Legimi.CATEGORIES.keys()),
+    },
+    Audience: {
+        'autocomplete': {
+            'source': '/catalogue/terms/audience/',
+        }
     },
     ThemaCategory: {
         'autocomplete': {
             'source': '/catalogue/terms/thema/',
     },
     ThemaCategory: {
         'autocomplete': {
             'source': '/catalogue/terms/thema/',
-        }
+        },
+        'chooser': {
+            'source': '/catalogue/chooser/thema/',
+        },
+    },
+    MainThemaCategory: {
+        'autocomplete': {
+            'source': '/catalogue/terms/thema-main/',
+        },
+        'chooser': {
+            'source': '/catalogue/chooser/thema-main/',
+        },
     },
     Epoch: {
         'autocomplete': {
     },
     Epoch: {
         'autocomplete': {
@@ -150,7 +166,17 @@ class MetaTagsView(View):
                     )
                 )
             )
                     )
                 )
             )
-            fields.append(d)
+            if d['name'] == 'thema':
+                d_loc = d.copy()
+                d_time = d.copy()
+                d['filter'] = {'not': {'startswith': ['1', '3']}}
+                d_loc['filter'] = {'startswith': ['1']}
+                d_loc['name'] += ' (miejsca)'
+                d_time['filter'] = {'startswith': ['3']}
+                d_time['name'] += ' (czas)'
+                fields.extend([d, d_loc, d_time])
+            else:
+                fields.append(d)
 
         return HttpResponse(
             'let META_FIELDS = ' + json.dumps(fields),
 
         return HttpResponse(
             'let META_FIELDS = ' + json.dumps(fields),