mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 17:52:19 +03:00
changed filter
This commit is contained in:
parent
8bda68fbf7
commit
875bb4a024
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user