Skip to content

Commit 3bd07ac

Browse files
committed
Merge pull request #153 from philippbosch/1.9-compatibility
Django 1.9 compatibility
2 parents 356827b + ec0e894 commit 3bd07ac

File tree

7 files changed

+34
-6
lines changed

7 files changed

+34
-6
lines changed

django_rq/templates/django_rq/clear_queue.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "admin/base_site.html" %}
22

3+
{% load admin_static %}
4+
35
{% block extrastyle %}
46
{{ block.super }}
57
<style>
@@ -9,7 +11,7 @@
911
width: 80%;
1012
}
1113
</style>
12-
<link href="{{ STATIC_URL }}admin/css/forms.css" type="text/css" rel="stylesheet">
14+
<link href="{% static 'admin/css/forms.css' %}" type="text/css" rel="stylesheet">
1315
{% endblock %}
1416

1517
{% block breadcrumbs %}

django_rq/templates/django_rq/confirm_action.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "admin/base_site.html" %}
22

3+
{% load admin_static %}
4+
35
{% block extrastyle %}
46
{{ block.super }}
57
<style>
@@ -9,7 +11,7 @@
911
width: 80%;
1012
}
1113
</style>
12-
<link href="{{ STATIC_URL }}admin/css/forms.css" type="text/css" rel="stylesheet">
14+
<link href="{% static 'admin/css/forms.css' %}" type="text/css" rel="stylesheet">
1315
{% endblock %}
1416

1517
{% block breadcrumbs %}

django_rq/templates/django_rq/delete_job.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "admin/base_site.html" %}
22

3+
{% load admin_static %}
4+
35
{% block extrastyle %}
46
{{ block.super }}
57
<style>
@@ -9,7 +11,7 @@
911
width: 80%;
1012
}
1113
</style>
12-
<link href="{{ STATIC_URL }}admin/css/forms.css" type="text/css" rel="stylesheet">
14+
<link href="{% static 'admin/css/forms.css' %}" type="text/css" rel="stylesheet">
1315
{% endblock %}
1416

1517
{% block breadcrumbs %}

django_rq/templates/django_rq/job_detail.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "admin/base_site.html" %}
22

3+
{% load admin_static %}
4+
35
{% block extrastyle %}
46
{{ block.super }}
57
<style>
@@ -11,7 +13,7 @@
1113
padding-top: 3px;
1214
}
1315
</style>
14-
<link href="{{ STATIC_URL }}admin/css/forms.css" type="text/css" rel="stylesheet">
16+
<link href="{% static 'admin/css/forms.css' %}" type="text/css" rel="stylesheet">
1517
{% endblock %}
1618

1719
{% block breadcrumbs %}

django_rq/templates/django_rq/jobs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "admin/base_site.html" %}
22

3-
{% load admin_static %}
3+
{% load admin_static jquery_path %}
44

55
{% block extrastyle %}
66
{{ block.super }}
@@ -9,7 +9,7 @@
99

1010
{% block extrahead %}
1111
{{ block.super }}
12-
<script type="text/javascript" src="{% static "admin/js/jquery.js" %}"></script>
12+
<script type="text/javascript" src="{% get_jquery_path as jquery_path %}{% static jquery_path %}"></script>
1313
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
1414
<script type="text/javascript" src="{% static "admin/js/actions.js" %}"></script>
1515
<script type="text/javascript">

django_rq/templatetags/__init__.py

Whitespace-only changes.

django_rq/templatetags/jquery_path.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from distutils.version import LooseVersion
2+
from django import template
3+
from django.utils.version import get_version
4+
5+
6+
register = template.Library()
7+
8+
if LooseVersion(get_version()) >= LooseVersion('1.9'):
9+
JQUERY_PATH = 'admin/js/vendor/jquery/jquery.js'
10+
11+
# `assignment_tag` is deprecated as of 1.9, `simple_tag` should be used
12+
tag_decorator = register.simple_tag
13+
else:
14+
JQUERY_PATH = 'admin/js/jquery.js'
15+
tag_decorator = register.assignment_tag
16+
17+
18+
@register.assignment_tag
19+
def get_jquery_path():
20+
return JQUERY_PATH

0 commit comments

Comments
 (0)