@@ -280,9 +280,9 @@ def get_link(self, path, method, generator):
280
280
fields = self .get_path_fields (path , method )
281
281
fields += self .get_serializer_fields (path , method )
282
282
fields += self .get_pagination_fields (path , method )
283
+ fields += self .get_filter_fields (path , method )
283
284
284
285
# TEMP: now we proxy back to the generator
285
- fields += generator .get_filter_fields (path , method , view )
286
286
287
287
if fields and any ([field .location in ('form' , 'body' ) for field in fields ]):
288
288
encoding = generator .get_encoding (path , method , view )
@@ -442,6 +442,19 @@ def get_pagination_fields(self, path, method):
442
442
paginator = view .pagination_class ()
443
443
return paginator .get_schema_fields (view )
444
444
445
+ def get_filter_fields (self , path , method ):
446
+ view = self .view
447
+
448
+ if not is_list_view (path , method , view ):
449
+ return []
450
+
451
+ if not getattr (view , 'filter_backends' , None ):
452
+ return []
453
+
454
+ fields = []
455
+ for filter_backend in view .filter_backends :
456
+ fields += filter_backend ().get_schema_fields (view )
457
+ return fields
445
458
446
459
# TODO: Where should this live?
447
460
# - We import APIView here. So we can't import the descriptor into `views`
@@ -650,18 +663,6 @@ def get_encoding(self, path, method, view):
650
663
651
664
return None
652
665
653
- def get_filter_fields (self , path , method , view ):
654
- if not is_list_view (path , method , view ):
655
- return []
656
-
657
- if not getattr (view , 'filter_backends' , None ):
658
- return []
659
-
660
- fields = []
661
- for filter_backend in view .filter_backends :
662
- fields += filter_backend ().get_schema_fields (view )
663
- return fields
664
-
665
666
# Method for generating the link layout....
666
667
667
668
def get_keys (self , subpath , method , view ):
0 commit comments