mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-13 16:54:47 +03:00
Merge 0b5cbea68e
into c0166d95bb
This commit is contained in:
commit
b677dfb701
|
@ -249,7 +249,9 @@ class OrderingFilter(BaseFilterBackend):
|
||||||
return (ordering,)
|
return (ordering,)
|
||||||
return ordering
|
return ordering
|
||||||
|
|
||||||
def get_default_valid_fields(self, queryset, view, context={}):
|
def get_default_valid_fields(self, queryset, view, context=None):
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
# If `ordering_fields` is not specified, then we determine a default
|
# If `ordering_fields` is not specified, then we determine a default
|
||||||
# based on the serializer class, if one exists on the view.
|
# based on the serializer class, if one exists on the view.
|
||||||
if hasattr(view, 'get_serializer_class'):
|
if hasattr(view, 'get_serializer_class'):
|
||||||
|
@ -286,7 +288,9 @@ class OrderingFilter(BaseFilterBackend):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_valid_fields(self, queryset, view, context={}):
|
def get_valid_fields(self, queryset, view, context=None):
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
valid_fields = getattr(view, 'ordering_fields', self.ordering_fields)
|
valid_fields = getattr(view, 'ordering_fields', self.ordering_fields)
|
||||||
|
|
||||||
if valid_fields is None:
|
if valid_fields is None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user