From 6c7e3b7d082affb3d779049d5311eb5775de65dd Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 20 Jun 2013 14:53:36 +0200 Subject: [PATCH] auto-count on main --- catalogue/templates/catalogue/snippets/carousel.html | 3 ++- catalogue/templatetags/catalogue_tags.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/catalogue/templates/catalogue/snippets/carousel.html b/catalogue/templates/catalogue/snippets/carousel.html index 75a3b2c..82984cf 100755 --- a/catalogue/templates/catalogue/snippets/carousel.html +++ b/catalogue/templates/catalogue/snippets/carousel.html @@ -6,7 +6,8 @@
  • diff --git a/catalogue/templatetags/catalogue_tags.py b/catalogue/templatetags/catalogue_tags.py index 32a5a0b..7003dfe 100755 --- a/catalogue/templatetags/catalogue_tags.py +++ b/catalogue/templatetags/catalogue_tags.py @@ -8,8 +8,12 @@ register = template.Library() @register.inclusion_tag("catalogue/snippets/carousel.html") def catalogue_carousel(): - return { - } + lessons_count = Lesson.objects.filter(type__in=('course', 'synthetic')).count() + if 1 < lessons_count % 10 < 5 and lessons_count / 10 % 10 != 1: + lessons_desc = u'kompletne lekcje' + else: + lessons_desc = u'kompletnych lekcji' + return locals() @register.inclusion_tag("catalogue/snippets/section_buttons.html") def catalogue_section_buttons(): -- 2.20.1