mirror of
https://github.com/jazzband/django-admin-sortable.git
synced 2026-05-10 08:14:51 +00:00
Remove filter_expression which breaks change order
This commit is contained in:
parent
6d5f9e97b4
commit
fcc84ec00d
3 changed files with 0 additions and 35 deletions
|
|
@ -116,7 +116,6 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
||||||
"""
|
"""
|
||||||
# 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')
|
||||||
filter_expression = request.GET.get('filter_expression')
|
|
||||||
|
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
|
|
@ -126,11 +125,6 @@ class SortableAdmin(SortableAdminBase, ModelAdmin):
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if filter_expression:
|
|
||||||
filters.update(
|
|
||||||
dict([filter_expression.split('=')])
|
|
||||||
)
|
|
||||||
|
|
||||||
# Apply any sort filters to create a subset of sortable objects
|
# Apply any sort filters to create a subset of sortable objects
|
||||||
return self.get_queryset(request).filter(**filters)
|
return self.get_queryset(request).filter(**filters)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,23 +29,6 @@
|
||||||
<script src="{% static 'adminsortable/js/jquery.ui.touch-punch.min.js' %}"></script>
|
<script src="{% static 'adminsortable/js/jquery.ui.touch-punch.min.js' %}"></script>
|
||||||
{% include 'adminsortable/csrf/jquery.django-csrf.html' with csrf_cookie_name=csrf_cookie_name %}
|
{% include 'adminsortable/csrf/jquery.django-csrf.html' with csrf_cookie_name=csrf_cookie_name %}
|
||||||
{% include 'adminsortable/admin.sortable.html' with after_sorting_js_callback_name=after_sorting_js_callback_name %}
|
{% include 'adminsortable/admin.sortable.html' with after_sorting_js_callback_name=after_sorting_js_callback_name %}
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function($) {
|
|
||||||
$(document).ready(function($) {
|
|
||||||
var url = window.location.href;
|
|
||||||
var urlParts = url.split('?');
|
|
||||||
var changeListUrl = $('a#return-to-changelist').attr('href');
|
|
||||||
|
|
||||||
if (urlParts.length === 2) {
|
|
||||||
$('a#return-to-changelist').attr(
|
|
||||||
'href',
|
|
||||||
changeListUrl + '?' + urlParts[1].replace('filter_expression=', '')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(django.jQuery);
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}
|
{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,6 @@
|
||||||
|
|
||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<script type="text/javascript">
|
|
||||||
(function($) {
|
|
||||||
$(document).ready(function($) {
|
|
||||||
var url = window.location.href;
|
|
||||||
var urlParts = url.split('?');
|
|
||||||
|
|
||||||
if (urlParts.length === 2) {
|
|
||||||
$('a#change-order').attr('href', './sort/?filter_expression=' + urlParts[1]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(django.jQuery);
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue