[Update] 修改command options get view filter

pull/3902/head
ibuler 5 years ago
parent 93bf15adc9
commit 3648a1458b

@ -84,8 +84,7 @@ class SimpleMetadataWithFilters(SimpleMetadata):
def get_filters_fields(self, request, view):
fields = []
if hasattr(view, 'get_filter_fields'):
# fields = view.get_filter_fields(request)
fields = view.get_filter_fields()
fields = view.get_filter_fields(request)
elif hasattr(view, 'filter_fields'):
fields = view.filter_fields
return fields
@ -93,9 +92,9 @@ class SimpleMetadataWithFilters(SimpleMetadata):
def get_ordering_fields(self, request, view):
fields = []
if hasattr(view, 'get_ordering_fields'):
fields = view.get_filter_fields(request)
fields = view.get_ordering_fields(request)
elif hasattr(view, 'ordering_fields'):
fields = view.filter_fields
fields = view.ordering_fields
return fields
def determine_metadata(self, request, view):

@ -63,7 +63,7 @@ class CommandQueryMixin:
def filter_queryset(self, queryset):
return queryset
def get_filter_fields(self):
def get_filter_fields(self, request):
fields = self.filter_fields
fields.extend(["date_from", "date_to"])
return fields

Loading…
Cancel
Save