Leftovers
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 27 Aug 2024 10:55:46 +0000 (12:55 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 27 Aug 2024 10:55:46 +0000 (12:55 +0200)
src/catalogue/templates/catalogue/catalogue.html
src/catalogue/urls.py
src/catalogue/views.py

index 294df77..278029b 100644 (file)
@@ -29,8 +29,5 @@
 
     <h2>{% trans "Kolekcje" %}</h2>
     {% plain_list collections paged=False %}
-
-    <h2>{% trans "Sztuka" %}</h2>
-    {% plain_list pictures by_author=True paged=False initial_blocks=True %}
   </div>
 {% endblock %}{% endblock %}
index bb00c8a..91c66a2 100644 (file)
@@ -23,7 +23,6 @@ urlpatterns = [
     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'),
@@ -64,8 +63,6 @@ urlpatterns = [
     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'},
index fc01ad6..e8808b4 100644 (file)
@@ -23,7 +23,6 @@ from club.forms import DonationStep1Form
 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
@@ -39,7 +38,6 @@ staff_required = user_passes_test(lambda user: user.is_staff)
 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',
     })
@@ -195,22 +193,6 @@ class BookList(ObjectListView):
         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([]))
@@ -228,14 +210,6 @@ class AudiobooksView(LiteratureView):
         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()