Merge pull request #121 from KuroiDOC/master
Variable jQuery location for Django version 1.9 and above
This commit is contained in:
Regular → Executable
+5
-1
@@ -108,6 +108,9 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
|||||||
has_perm = request.user.has_perm('{0}.{1}'.format(opts.app_label,
|
has_perm = request.user.has_perm('{0}.{1}'.format(opts.app_label,
|
||||||
opts.get_change_permission()))
|
opts.get_change_permission()))
|
||||||
|
|
||||||
|
jquery_lib_path = 'admin/js/jquery.js' if VERSION < (1, 9) \
|
||||||
|
else 'admin/js/vendor/jquery/jquery.js'
|
||||||
|
|
||||||
# get sort group index from querystring if present
|
# get sort group index from querystring if present
|
||||||
sort_filter_index = request.GET.get('sort_filter')
|
sort_filter_index = request.GET.get('sort_filter')
|
||||||
|
|
||||||
@@ -182,7 +185,8 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
|||||||
'group_expression': sortable_by_expression,
|
'group_expression': sortable_by_expression,
|
||||||
'sortable_by_class': sortable_by_class,
|
'sortable_by_class': sortable_by_class,
|
||||||
'sortable_by_class_is_sortable': sortable_by_class_is_sortable,
|
'sortable_by_class_is_sortable': sortable_by_class_is_sortable,
|
||||||
'sortable_by_class_display_name': sortable_by_class_display_name
|
'sortable_by_class_display_name': sortable_by_class_display_name,
|
||||||
|
'jquery_lib_path': jquery_lib_path
|
||||||
}
|
}
|
||||||
return render(request, self.sortable_change_list_template, context)
|
return render(request, self.sortable_change_list_template, context)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<script src="{% static 'admin/js/jquery.js' %}"></script>
|
<script src="{% static jquery_lib_path %}"></script>
|
||||||
<script src="{% static 'admin/js/jquery.init.js' %}"></script>
|
<script src="{% static 'admin/js/jquery.init.js' %}"></script>
|
||||||
<script src="{% static 'adminsortable/js/jquery-ui-django-admin.min.js' %}"></script>
|
<script src="{% static 'adminsortable/js/jquery-ui-django-admin.min.js' %}"></script>
|
||||||
<script src="{% static 'adminsortable/js/jquery.django-csrf.js' %}"></script>
|
<script src="{% static 'adminsortable/js/jquery.django-csrf.js' %}"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user