Skip to content
Snippets Groups Projects
Commit 04bc1372 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

use absolut url on demand

parent 5c75969c
No related branches found
Tags v0.2.46
No related merge requests found
Pipeline #40982 passed
...@@ -10,13 +10,17 @@ from django.core.cache import cache ...@@ -10,13 +10,17 @@ from django.core.cache import cache
register = template.Library() register = template.Library()
__USE_ABSOLUT_URL_FOR_STATIC = getattr(settings, "USE_ABSOLUT_URL_FOR_STATIC", False)
@register.simple_tag(takes_context=True) @register.simple_tag(takes_context=True)
def sstatic(context, path): def sstatic(context, path):
url = cache.get(path) url = cache.get(path)
if url: if url:
return 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) cache.set(path, url, None)
return url return url
......
...@@ -7,7 +7,7 @@ readme = open('README.rst').read() ...@@ -7,7 +7,7 @@ readme = open('README.rst').read()
setup( setup(
name='django-basetheme-bootstrap', name='django-basetheme-bootstrap',
version='0.2.45', version='0.2.46',
description='Django Basetheme Bootstrap', description='Django Basetheme Bootstrap',
long_description=readme, long_description=readme,
author='Bryan Brancotte', author='Bryan Brancotte',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment