From: Radek Czajka Date: Mon, 22 Jul 2019 09:14:59 +0000 (+0200) Subject: Banner fixes. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/124d23a42f7e6153c8b4de59dd337bdd98a9d893?ds=inline;hp=beb5154606f790915bc56b9cb8af824537cc7d7a Banner fixes. --- diff --git a/src/social/templates/social/carousel.html b/src/social/templates/social/carousel.html index ed63b5bf1..64380bc50 100644 --- a/src/social/templates/social/carousel.html +++ b/src/social/templates/social/carousel.html @@ -5,9 +5,11 @@ data-cycle-pause-on-hover="true" > -
-
-
+ {% if banners|length > 1 %} +
+
+
+ {% endif %} {% for banner in banners %} {% if banner %} diff --git a/src/social/templatetags/social_tags.py b/src/social/templatetags/social_tags.py index 90ed51817..0af1da285 100644 --- a/src/social/templatetags/social_tags.py +++ b/src/social/templatetags/social_tags.py @@ -57,7 +57,7 @@ def carousel(context, slug): carousel = Carousel.objects.get(slug=slug) except Carousel.DoesNotExist: # TODO: add sanity check for install. - carousel = None + carousel = Carousel.objects.create(slug=slug) banners = [ item.get_banner() for item in carousel.carouselitem_set.all().select_related('banner')