add timestamp as query string to static assets (#23482)
This commit is contained in:
parent
f943e7fe4d
commit
87ffc1ea22
|
@ -3,16 +3,16 @@
|
|||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>{% block page-title %}{% endblock %}</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="{% static "css/gadjo.css" %}"/>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="{% static "css/gadjo.css" %}?{% start_timestamp %} "/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
{% block gadjo-js %}
|
||||
<script src="{% xstatic 'jquery' 'jquery.min.js' %}"></script>
|
||||
<script src="{% xstatic 'jquery-ui' 'jquery-ui.min.js' %}"></script>
|
||||
<script src="{% static "js/gadjo.js" %}"></script>
|
||||
<script src="{% static "js/gadjo.js" %}?{% start_timestamp %}"></script>
|
||||
{% endblock %}
|
||||
{{ media }}
|
||||
{% block css %}
|
||||
<link rel="stylesheet" type="text/css" media="all" href="{% static "css/style.css" %}"/>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="{% static "css/style.css" %}?{% start_timestamp %}"/>
|
||||
{% endblock %}
|
||||
{% block extrascripts %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from collections import OrderedDict
|
||||
import re
|
||||
import time
|
||||
|
||||
from xstatic.main import XStatic
|
||||
|
||||
|
@ -42,6 +43,13 @@ def xstatic(modname, filename):
|
|||
return settings.STATIC_URL + 'xstatic/' + filename
|
||||
|
||||
|
||||
START_TIMESTAMP = time.strftime('%Y%m%d.%H%M%S')
|
||||
|
||||
@register.simple_tag
|
||||
def start_timestamp():
|
||||
return START_TIMESTAMP
|
||||
|
||||
|
||||
# {% querystring %} bits originally from django-tables2.
|
||||
kwarg_re = re.compile(r"(?:(.+)=)?(.+)")
|
||||
|
||||
|
|
Loading…
Reference in New Issue