path('rodzaj/', views.tag_catalogue, {'category': 'kind'}, name='kind_catalogue'),
path('motyw/', views.tag_catalogue, {'category': 'theme'}, name='theme_catalogue'),
- path('galeria/', views.GalleryView.as_view(), name='gallery'),
path('kolekcje/', views.collections, name='catalogue_collections'),
path('lektury/', views.LiteratureView.as_view(), name='book_list'),
path('isbn/<slug:book_format>/<slug:slug>/', views.get_isbn),
# This should be the last pattern.
- re_path(r'^galeria/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'gallery'},
- name='tagged_object_list_gallery'),
re_path(r'^audiobooki/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'audiobooks'},
name='tagged_object_list_audiobooks'),
re_path(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'books'},
from club.models import Club
from annoy.models import DynamicTextInsert
from pdcounter import views as pdcounter_views
-from picture.models import Picture, PictureArea
from wolnelektury.utils import is_ajax
from catalogue import constants
from catalogue import forms
def catalogue(request):
return render(request, 'catalogue/catalogue.html', {
'books': Book.objects.filter(findable=True, parent=None),
- 'pictures': Picture.objects.all(),
'collections': Collection.objects.filter(listed=True),
'active_menu_item': 'all_works',
})
return qs
-class ArtList(ObjectListView):
- template_name = 'catalogue/book_list.html'
- dynamic_template_name = 'catalogue/dynamic_book_list.html'
- title = gettext_lazy('Sztuka')
- list_type = 'gallery'
-
- def get_queryset(self):
- return Picture.objects.all()
-
- def search(self, qs):
- term = self.request.GET.get('search')
- if term:
- qs = qs.filter(Q(title__icontains=term) | Q(tag_relations__tag__name_pl__icontains=term)).distinct()
- return qs
-
-
class LiteratureView(BookList):
def get_suggested_tags(self, queryset):
tags = list(get_top_level_related_tags([]))
return Book.objects.filter(findable=True, media__type='mp3').distinct()
-class GalleryView(ArtList):
- def get_suggested_tags(self, queryset):
- return Tag.objects.usage_for_queryset(
- queryset,
- counts=True
- ).exclude(pk__in=[t.id for t in self.ctx['tags']]).order_by('-count')
-
-
class TaggedObjectList(BookList):
def analyse(self):
super().analyse()