Added matching for PAGE_VAR

master
Brandon Taylor 2019-04-17 11:24:43 -04:00
parent ff4dc3184f
commit 97003cd5cc
1 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from django.conf import settings
from django.conf.urls import url from django.conf.urls import url
from django.contrib.admin import ModelAdmin, TabularInline, StackedInline from django.contrib.admin import ModelAdmin, TabularInline, StackedInline
from django.contrib.admin.options import InlineModelAdmin from django.contrib.admin.options import InlineModelAdmin
from django.contrib.admin.views.main import IGNORED_PARAMS, PAGE_VAR
from django.contrib.contenttypes.admin import (GenericStackedInline, from django.contrib.contenttypes.admin import (GenericStackedInline,
GenericTabularInline) GenericTabularInline)
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
@ -34,6 +35,15 @@ class SortableAdminBase(object):
after_sorting_js_callback_name = None after_sorting_js_callback_name = None
def get_querystring_filters(self, request):
filters = {}
for k, v in request.GET.items():
if k not in IGNORED_PARAMS and k != PAGE_VAR:
filters[k] = v
return filters
def changelist_view(self, request, extra_context=None): def changelist_view(self, request, extra_context=None):
""" """
If the model that inherits Sortable has more than one object, If the model that inherits Sortable has more than one object,