aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorTom Christie2014-08-29 10:48:40 +0100
committerTom Christie2014-08-29 10:48:40 +0100
commitf62c874ea9621ae67fb56e7e453dca8fd5039051 (patch)
treed348b76e3a5e12bdf685b9ef9d2f7858131d182d /rest_framework
parentd8eb9e6d45c227582559ec4318b1f92562c718da (diff)
downloaddjango-rest-framework-f62c874ea9621ae67fb56e7e453dca8fd5039051.tar.bz2
Remove `filter_backend`.
Closes #1775.
Diffstat (limited to 'rest_framework')
-rw-r--r--rest_framework/generics.py20
-rw-r--r--rest_framework/settings.py10
2 files changed, 1 insertions, 29 deletions
diff --git a/rest_framework/generics.py b/rest_framework/generics.py
index a6f68657..8bacf470 100644
--- a/rest_framework/generics.py
+++ b/rest_framework/generics.py
@@ -83,7 +83,6 @@ class GenericAPIView(views.APIView):
slug_url_kwarg = 'slug'
slug_field = 'slug'
allow_empty = True
- filter_backend = api_settings.FILTER_BACKEND
def get_serializer_context(self):
"""
@@ -191,24 +190,7 @@ class GenericAPIView(views.APIView):
"""
Returns the list of filter backends that this view requires.
"""
- if self.filter_backends is None:
- filter_backends = []
- else:
- # Note that we are returning a *copy* of the class attribute,
- # so that it is safe for the view to mutate it if needed.
- filter_backends = list(self.filter_backends)
-
- if not filter_backends and self.filter_backend:
- warnings.warn(
- 'The `filter_backend` attribute and `FILTER_BACKEND` setting '
- 'are deprecated in favor of a `filter_backends` '
- 'attribute and `DEFAULT_FILTER_BACKENDS` setting, that take '
- 'a *list* of filter backend classes.',
- DeprecationWarning, stacklevel=2
- )
- filter_backends = [self.filter_backend]
-
- return filter_backends
+ return list(self.filter_backends)
# The following methods provide default implementations
# that you may want to override for more complex cases.
diff --git a/rest_framework/settings.py b/rest_framework/settings.py
index 644751f8..bbe7a56a 100644
--- a/rest_framework/settings.py
+++ b/rest_framework/settings.py
@@ -111,9 +111,6 @@ DEFAULTS = {
),
'TIME_FORMAT': None,
- # Pending deprecation
- 'FILTER_BACKEND': None,
-
}
@@ -129,7 +126,6 @@ IMPORT_STRINGS = (
'DEFAULT_PAGINATION_SERIALIZER_CLASS',
'DEFAULT_FILTER_BACKENDS',
'EXCEPTION_HANDLER',
- 'FILTER_BACKEND',
'TEST_REQUEST_RENDERER_CLASSES',
'UNAUTHENTICATED_USER',
'UNAUTHENTICATED_TOKEN',
@@ -196,15 +192,9 @@ class APISettings(object):
if val and attr in self.import_strings:
val = perform_import(val, attr)
- self.validate_setting(attr, val)
-
# Cache the result
setattr(self, attr, val)
return val
- def validate_setting(self, attr, val):
- if attr == 'FILTER_BACKEND' and val is not None:
- # Make sure we can initialize the class
- val()
api_settings = APISettings(USER_SETTINGS, DEFAULTS, IMPORT_STRINGS)