Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
8d72535b
Commit
8d72535b
authored
Nov 07, 2016
by
Tom Christie
Committed by
GitHub
Nov 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix FilterSet warnings. (#4660)
parent
06df61e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
17 deletions
+5
-17
rest_framework/filters.py
+5
-17
No files found.
rest_framework/filters.py
View file @
8d72535b
...
...
@@ -38,31 +38,19 @@ class BaseFilterBackend(object):
if
django_filters
:
from
django_filters.filterset
import
FilterSetMetaclass
as
DFFilterSetMetaclass
from
django_filters.rest_framework.filterset
import
FilterSet
as
DFFilterSet
class
FilterSet
Metaclass
(
DFFilterSetMetaclass
):
def
__
new__
(
cls
,
name
,
bases
,
attr
s
):
class
FilterSet
(
DFFilterSet
):
def
__
init__
(
self
,
*
args
,
**
kwarg
s
):
warnings
.
warn
(
"The built in 'rest_framework.filters.FilterSet' is pending deprecation. "
"You should use 'django_filters.rest_framework.FilterSet' instead."
,
PendingDeprecationWarning
)
return
super
(
FilterSetMetaclass
,
cls
)
.
__new__
(
cls
,
name
,
bases
,
attrs
)
_BaseFilterSet
=
DFFilterSet
return
super
(
FilterSet
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
else
:
# Dummy metaclass just so we can give a user-friendly error message.
class
FilterSetMetaclass
(
type
):
def
__init__
(
self
,
name
,
bases
,
attrs
):
# Assert only on subclasses, so we can define FilterSet below.
if
bases
!=
(
object
,):
assert
False
,
'django-filter must be installed to use the `FilterSet` class'
super
(
FilterSetMetaclass
,
self
)
.
__init__
(
name
,
bases
,
attrs
)
_BaseFilterSet
=
object
class
FilterSet
(
six
.
with_metaclass
(
FilterSetMetaclass
,
_BaseFilterSet
)):
pass
def
FilterSet
():
assert
False
,
'django-filter must be installed to use the `FilterSet` class'
class
DjangoFilterBackend
(
BaseFilterBackend
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment