X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/ae2a8df21e1038038cf898eb5a9d09b9ecc33f8f..da0fee096a166c7fd97857af84d99fe2facfe7f3:/src/wlxml/views.py?ds=sidebyside diff --git a/src/wlxml/views.py b/src/wlxml/views.py index 3784b777..8c03e058 100644 --- a/src/wlxml/views.py +++ b/src/wlxml/views.py @@ -8,7 +8,7 @@ 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, MainThemaCategory -from depot.legimi import legimi +from depot.publishers.legimi import Legimi class XslView(TemplateView): @@ -48,7 +48,7 @@ class TagView(DetailView): VALUE_TYPES = { LegimiCategory: { 'widget': 'select', - 'options': [''] + list(legimi.CATEGORIES.keys()), + 'options': [''] + list(Legimi.CATEGORIES.keys()), }, Audience: { 'autocomplete': { @@ -58,12 +58,18 @@ VALUE_TYPES = { 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': { @@ -160,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),