From 07cd561683d722537e51ca728c584abb7caec92f Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 9 Dec 2025 15:45:33 +0100 Subject: [PATCH] banner fix --- src/annoy/models.py | 8 +++++++- src/annoy/templates/annoy/banner.html | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/annoy/models.py b/src/annoy/models.py index 097872b40..6af1cc045 100644 --- a/src/annoy/models.py +++ b/src/annoy/models.py @@ -66,7 +66,13 @@ class Banner(models.Model): return self.campaign.image else: return self.image - + + def is_external(self): + return (self.url and + not self.url.startswith('/') and + not self.url.startswith('https://wolnelektury.pl/') + ) + @classmethod def choice(cls, place, request, exemptions=True, book=None): Membership = apps.get_model('club', 'Membership') diff --git a/src/annoy/templates/annoy/banner.html b/src/annoy/templates/annoy/banner.html index bfecd9d36..9a67fcdcb 100644 --- a/src/annoy/templates/annoy/banner.html +++ b/src/annoy/templates/annoy/banner.html @@ -20,7 +20,9 @@ {% if banner.background_color %}background-color: {{ banner.background_color }};{% endif %} "> {% if not banner.action_label %} - + {% endif %}
@@ -34,7 +36,9 @@
{% if banner.action_label %} -
+ {{ banner.action_label }} {% endif %} -- 2.20.1