mirror of
https://github.com/jazzband/django-admin-sortable.git
synced 2026-04-15 12:21:08 +00:00
add: Allow to define custom ignore list in query params
Not all query params can be model fields for querysets. User can define custom ListFilter and get_queryset on it. Provide option to ignore the params for filters on SortableAdmin.
This commit is contained in:
parent
b9c1f3e0c4
commit
1eb931b340
1 changed files with 7 additions and 2 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import json
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from django.conf import settings
|
||||
|
|
@ -36,11 +35,17 @@ class SortableAdminBase(object):
|
|||
|
||||
after_sorting_js_callback_name = None
|
||||
|
||||
sortable_ignored_params = ()
|
||||
|
||||
def get_querystring_filters(self, request):
|
||||
filters = {}
|
||||
|
||||
for k, v in request.GET.items():
|
||||
if k not in IGNORED_PARAMS and k != PAGE_VAR:
|
||||
if (
|
||||
k not in IGNORED_PARAMS
|
||||
and k != PAGE_VAR
|
||||
and k not in self.sortable_ignored_params
|
||||
):
|
||||
filters[k] = v
|
||||
|
||||
return filters
|
||||
|
|
|
|||
Loading…
Reference in a new issue