From 3deefcf48d775eb7d4cb1a41a51b8ff501f108ed Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 27 Aug 2024 15:56:07 +0200 Subject: [PATCH 1/1] Find unused tags. --- src/catalogue/templates/catalogue/book_list.html | 1 + .../templates/catalogue/themed_book_list.html | 1 + src/reporting/templates/reporting/main.html | 14 ++++++++++++++ src/reporting/views.py | 5 ++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/catalogue/templates/catalogue/book_list.html b/src/catalogue/templates/catalogue/book_list.html index e8debd975..c57bdd3f9 100644 --- a/src/catalogue/templates/catalogue/book_list.html +++ b/src/catalogue/templates/catalogue/book_list.html @@ -17,6 +17,7 @@ {% block main %}
+ {% if main_tag.photo %} {% thumbnail main_tag.photo '40x40' crop='top' as th %}
diff --git a/src/catalogue/templates/catalogue/themed_book_list.html b/src/catalogue/templates/catalogue/themed_book_list.html index 665233d22..dc54f7698 100644 --- a/src/catalogue/templates/catalogue/themed_book_list.html +++ b/src/catalogue/templates/catalogue/themed_book_list.html @@ -17,6 +17,7 @@
+

{% trans "Motyw" %}: {{ main_tag.name }}

diff --git a/src/reporting/templates/reporting/main.html b/src/reporting/templates/reporting/main.html index e67ef78b9..903db3e26 100644 --- a/src/reporting/templates/reporting/main.html +++ b/src/reporting/templates/reporting/main.html @@ -16,6 +16,20 @@

Statystyka

+

Nieużywane tagi

+ +

+ Te tagi nie mają żadnych książek. + Prawdopodobnie można je usunąć, jeśli nie zawierają cennych informacji + albo czekają właśnie na publikację książki. +

+ + +

Audiobooki

diff --git a/src/reporting/views.py b/src/reporting/views.py index fca453420..553371efe 100644 --- a/src/reporting/views.py +++ b/src/reporting/views.py @@ -8,7 +8,7 @@ from django.contrib.admin.views.decorators import staff_member_required from django.db.models import Count from django.shortcuts import render -from catalogue.models import Book, BookMedia +from catalogue.models import Book, BookMedia, Tag from reporting.utils import render_to_pdf, render_to_csv, generated_file_view @@ -60,10 +60,13 @@ def stats_page(request): ] etags.append(d) + unused_tags = Tag.objects.exclude(category='set').filter(items=None, book=None) + return render(request, 'reporting/main.html', { 'media_types': media_types, 'licenses': licenses, 'etags': etags, + 'unused_tags': unused_tags, }) -- 2.20.1