X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/ed7cd4d7271acd67bf366e4d320f9c49f07a50ea..f8eb70938e6ea3b3c4fac5e2f55df26fcaf21b48:/src/wlxml/views.py?ds=sidebyside diff --git a/src/wlxml/views.py b/src/wlxml/views.py index 87780b79..ebc837dc 100644 --- a/src/wlxml/views.py +++ b/src/wlxml/views.py @@ -6,7 +6,8 @@ from . import models from librarian.dcparser import BookInfo from librarian.document import WLDocument from librarian.builders import StandaloneHtmlBuilder -from librarian.meta.types.text import LegimiCategory, Epoch, Kind, Genre, Audience +from librarian.meta.types.wluri import WLURI +from librarian.meta.types.text import LegimiCategory, Epoch, Kind, Genre, Audience, ThemaCategory from depot.legimi import legimi @@ -47,7 +48,12 @@ class TagView(DetailView): VALUE_TYPES = { LegimiCategory: { 'widget': 'select', - 'options': list(legimi.CATEGORIES.keys()), + 'options': [''] + list(legimi.CATEGORIES.keys()), + }, + ThemaCategory: { + 'autocomplete': { + 'source': '/catalogue/terms/thema/', + } }, Epoch: { 'autocomplete': { @@ -64,9 +70,63 @@ VALUE_TYPES = { 'source': '/catalogue/terms/genre/', } }, + WLURI: { + "autocomplete": { + "source": "/catalogue/terms/wluri/", + } + }, + "authors": { + "autocomplete": { + "source": "/catalogue/terms/author/", + } + }, + "translators": { + "autocomplete": { + "source": "/catalogue/terms/author/", + } + }, + "editors": { + "autocomplete": { + "source": "/catalogue/terms/editor/", + } + }, + "technical_editors": { + "autocomplete": { + "source": "/catalogue/terms/editor/", + } + }, + "type": { + "autocomplete": { + "source": ["text"] + } + }, + "title": { + "autocomplete": { + "source": "/catalogue/terms/book_title/", + } + }, + + "language": { + 'widget': 'select', + 'options': [ + '', + 'pol', + 'eng', + 'fre', + 'ger', + 'lit', + ], + }, + "publisher": { + "autocomplete": { + "source": ["Fundacja Nowoczesna Polska"] + } + }, + } - + + class MetaTagsView(View): def get(self, request): fields = [] @@ -81,7 +141,15 @@ class MetaTagsView(View): 'name': f.value_type.__name__, } } - d['value_type'].update(VALUE_TYPES.get(f.value_type, {})) + d['value_type'].update( + VALUE_TYPES.get( + f.value_type, + VALUE_TYPES.get( + f.name, + {} + ) + ) + ) fields.append(d) return HttpResponse(