def get_absolute_url(self):
return reverse("catalogue_author", args=[self.slug])
+ @property
+ def name(self):
+ return f"{self.last_name}, {self.first_name}"
+
@property
def pd_year(self):
if self.year_of_death:
def get_absolute_url(self):
return reverse("catalogue_book", args=[self.slug])
+
+ @property
+ def wluri(self):
+ return f'https://wolnelektury.pl/katalog/lektura/{self.slug}/'
def authors_str(self):
return ", ".join(str(author) for author in self.authors.all())
path('terms/epoch/', views.EpochTerms.as_view()),
path('terms/kind/', views.KindTerms.as_view()),
path('terms/genre/', views.GenreTerms.as_view()),
+ path('terms/wluri/', views.WLURITerms.as_view()),
+ path('terms/book_title/', views.BookTitleTerms.as_view()),
+ path('terms/author/', views.AuthorTerms.as_view()),
+
+ path('terms/editor/', views.EditorTerms.as_view()),
]
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.db.models import Prefetch
+from django.contrib.auth.models import User
from django.views.generic import DetailView, TemplateView
from . import models
import documents.models
queryset = models.Kind.objects.all()
class GenreTerms(Terms):
queryset = models.Genre.objects.all()
+
+class AuthorTerms(Terms):
+ search_fields = ['first_name', 'last_name']
+ queryset = models.Author.objects.all()
+
+class EditorTerms(Terms):
+ search_fields = ['first_name', 'last_name', 'username']
+ queryset = User.objects.all()
+
+ class serializer_class(serializers.Serializer):
+ label = serializers.SerializerMethodField()
+
+ def get_label(self, obj):
+ return f'{obj.last_name}, {obj.first_name}'
+
+class BookTitleTerms(Terms):
+ queryset = models.Book.objects.all()
+ search_fields = ['title', 'slug']
+
+ class serializer_class(serializers.Serializer):
+ label = serializers.CharField(source='title')
+
+class WLURITerms(Terms):
+ queryset = models.Book.objects.all()
+ search_fields = ['title', 'slug']
+
+ class serializer_class(serializers.Serializer):
+ label = serializers.CharField(source='wluri')
+
if (field.value_type.hasLanguage) {
span.attr('x-a-xml-lang', 'pl');
}
- span.appendTo(
- $("> [x-node='RDF'] > [x-node='Description']", self.$edited)
- );
+
+ rdf = $("> [x-node='RDF']", self.$edited);
+ if (!rdf.length) {
+ rdf = $("<span x-node='RDF' x-ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>");
+ self.$edited.prepend(rdf);
+ self.$edited.prepend('\n ');
+
+ }
+ rdfdesc = $("> [x-node='Description']", rdf);
+ if (!rdfdesc.length) {
+ rdfdesc = $("<span x-node='Description' x-ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#' x-a-rdf-about='" + self.doc.fullUri + "'>");
+ rdf.prepend(rdfdesc);
+ rdf.prepend('\n ');
+ rdfdesc.append('\n ');
+ rdf.append('\n ');
+ }
+ span.appendTo(rdfdesc);
+ rdfdesc.append('\n ');
self.displayMetaProperty($fg);
this.galleryLink = $("*[data-key='gallery']", meta).text();
this.galleryStart = parseInt($("*[data-key='gallery-start']", meta).text());
+ this.fullUri = $("*[data-key='full-uri']", meta).text();
var diff = $("*[data-key='diff']", meta).text();
if (diff) {
{% endblock %}
{% block dialogs %}
- {% include "wiki/save_dialog.html" %}
- {% include "wiki/revert_dialog.html" %}
- {% if can_pubmark %}
- {% include "wiki/pubmark_dialog.html" %}
- {% endif %}
+ {% include "wiki/save_dialog.html" %}
+ {% include "wiki/revert_dialog.html" %}
+ {% if can_pubmark %}
+ {% include "wiki/pubmark_dialog.html" %}
+ {% endif %}
+{% endblock %}
+
+
+{% block meta-extra %}
+ <span data-key="full-uri">{{ chunk.book.correct_about }}</span>
{% endblock %}
from librarian.dcparser import BookInfo
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
from depot.legimi import legimi
'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 = []
'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(