changed filter

This commit is contained in:
Mardanov Timur Rustemovich 2019-01-22 11:33:14 +03:00
parent 8bda68fbf7
commit 875bb4a024

View File

@ -5,7 +5,6 @@ from django_filters import Filter, MultipleChoiceFilter, VERSION
from django_filters.filterset import BaseFilterSet, FilterSet
from django_filters.filterset import FILTER_FOR_DBFIELD_DEFAULTS
from graphql_relay.node.node import from_global_id
from ..forms import GlobalIDFormField, GlobalIDMultipleChoiceField
@ -17,7 +16,7 @@ class GlobalIDFilter(Filter):
""" Convert the filter value to a primary key before filtering """
_id = None
if value is not None:
_, _id = from_global_id(value)
_id = value
return super(GlobalIDFilter, self).filter(qs, _id)
@ -25,8 +24,7 @@ class GlobalIDMultipleChoiceFilter(MultipleChoiceFilter):
field_class = GlobalIDMultipleChoiceField
def filter(self, qs, value):
gids = [from_global_id(v)[1] for v in value]
return super(GlobalIDMultipleChoiceFilter, self).filter(qs, gids)
return super(GlobalIDMultipleChoiceFilter, self).filter(qs, value)
GRAPHENE_FILTER_SET_OVERRIDES = {