From: Aleksander Łukasz Date: Thu, 9 May 2013 13:36:20 +0000 (+0200) Subject: Tag clouds: Hiding "uncategorized" category if no uncategorized tags exist X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/ec4f043363f5a71483cbd8c143c84cb8ca78fc02 Tag clouds: Hiding "uncategorized" category if no uncategorized tags exist --- diff --git a/questions/templates/questions/question_list.html b/questions/templates/questions/question_list.html index f279208..ccf2ad7 100755 --- a/questions/templates/questions/question_list.html +++ b/questions/templates/questions/question_list.html @@ -32,7 +32,9 @@ doświadczenie doradcze w tej tematyce.

Filtruj pytania

Wybierz kategorię tematów:
+ {% if has_uncategorized_tags %} bez kategorii + {% endif %} {% for category in tag_categories %} {{category}} {% endfor %} diff --git a/questions/views.py b/questions/views.py index 076a2e0..f35f5fe 100644 --- a/questions/views.py +++ b/questions/views.py @@ -65,5 +65,6 @@ class QuestionListView(ListView): category_click_count = uncategorized_tags_click_count tag.cloud_size = get_cloud_size(tag.click_count, category_click_count) context['tag_lists'].setdefault(tag.category.id if tag.category else 0, []).append(tag) + context['has_uncategorized_tags'] = 0 in context['tag_lists'] return context