From 04bc137249790d146084ee3a69593e0b0ec54264 Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Thu, 5 Nov 2020 15:14:48 +0100
Subject: [PATCH] use absolut url on demand

---
 basetheme_bootstrap/templatetags/sstatic.py | 6 +++++-
 setup.py                                    | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/basetheme_bootstrap/templatetags/sstatic.py b/basetheme_bootstrap/templatetags/sstatic.py
index e0a5c74..493b7d2 100644
--- a/basetheme_bootstrap/templatetags/sstatic.py
+++ b/basetheme_bootstrap/templatetags/sstatic.py
@@ -10,13 +10,17 @@ from django.core.cache import cache
 
 register = template.Library()
 
+__USE_ABSOLUT_URL_FOR_STATIC = getattr(settings, "USE_ABSOLUT_URL_FOR_STATIC", False)
+
 
 @register.simple_tag(takes_context=True)
 def sstatic(context, path):
     url = cache.get(path)
     if url:
         return url
-    url = get_absolut_url(context["request"], compute_url_for_path(path))
+    url = compute_url_for_path(path)
+    if __USE_ABSOLUT_URL_FOR_STATIC:
+        url = get_absolut_url(context["request"], url)
     cache.set(path, url, None)
     return url
 
diff --git a/setup.py b/setup.py
index da888db..67bf2f6 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ readme = open('README.rst').read()
 
 setup(
     name='django-basetheme-bootstrap',
-    version='0.2.45',
+    version='0.2.46',
     description='Django Basetheme Bootstrap',
     long_description=readme,
     author='Bryan Brancotte',
-- 
GitLab