Improve querystring filtering.

This changed excludes more querystring parameters and relies on Django's
knowledge of what keys should be excluded. It basically does the same
what the ChangeList class would do [1].

[1] https://github.com/django/django/blob/master/django/contrib/admin/views/main.py#L91-L102
master
Stephan Jaekel 2019-02-22 11:14:07 +01:00
parent e2bee04990
commit cdce5e453b
1 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ from django.conf import settings
from django.conf.urls import url
from django.contrib.admin import ModelAdmin, TabularInline, StackedInline
from django.contrib.admin.options import InlineModelAdmin
from django.contrib.admin.views.main import IGNORED_PARAMS
from django.contrib.contenttypes.admin import (GenericStackedInline,
GenericTabularInline)
from django.contrib.contenttypes.models import ContentType
@ -38,8 +39,8 @@ class SortableAdminBase(object):
filters = {}
for k, v in request.GET.items():
if k not in ['_to_field', '_popup',]:
filters.update({ k: v })
if k not in IGNORED_PARAMS:
filters[k] = v
return filters