@@ -44,12 +44,12 @@ def __init__(self, type, *args, **kwargs):
44
44
45
45
@property
46
46
def type (self ):
47
- from .types import GrapheneMongoengineObjectTypes
47
+ from .types import MongoengineObjectType
48
48
49
49
_type = super (ConnectionField , self ).type
50
50
assert issubclass (
51
- _type , GrapheneMongoengineObjectTypes
52
- ), "MongoengineConnectionField only accepts Mongoengine object types"
51
+ _type , MongoengineObjectType
52
+ ), "MongoengineConnectionField only accepts MongoengineObjectType types"
53
53
assert _type ._meta .connection , "The type {} doesn't have a connection" .format (
54
54
_type .__name__
55
55
)
@@ -79,7 +79,7 @@ def registry(self):
79
79
def args (self ):
80
80
return to_arguments (
81
81
self ._base_args or OrderedDict (),
82
- dict (dict (self .field_args , ** self .advance_args ), ** self .filter_args ),
82
+ dict (dict (dict ( self .field_args , ** self .advance_args ), ** self .filter_args ), ** self . extended_args ),
83
83
)
84
84
85
85
@args .setter
@@ -96,7 +96,8 @@ def is_filterable(k):
96
96
Returns:
97
97
bool
98
98
"""
99
-
99
+ if hasattr (self .fields [k ].type , '_sdl' ):
100
+ return False
100
101
if not hasattr (self .model , k ):
101
102
return False
102
103
if isinstance (getattr (self .model , k ), property ):
@@ -201,6 +202,14 @@ def get_advance_field(r, kv):
201
202
202
203
return reduce (get_advance_field , self .fields .items (), {})
203
204
205
+ @property
206
+ def extended_args (self ):
207
+ args = OrderedDict ()
208
+ for k , each in self .fields .items ():
209
+ if hasattr (each .type , '_sdl' ):
210
+ args .update ({k : graphene .ID ()})
211
+ return args
212
+
204
213
@property
205
214
def fields (self ):
206
215
self ._type = get_type (self ._type )
@@ -394,9 +403,6 @@ def chained_resolver(self, resolver, is_partial, root, info, **args):
394
403
self .filter_args .keys ()):
395
404
args_copy .pop (arg_name )
396
405
if arg_name == '_id' and isinstance (arg , dict ):
397
- args_copy ['pk__in' ] = arg ['$in' ]
398
- elif "$ne" in arg :
399
- args_copy ['pk__ne' ] = arg ['$ne' ]
400
406
operation = list (arg .keys ())[0 ]
401
407
args_copy ['pk' + operation .replace ('$' , '__' )] = arg [operation ]
402
408
if '.' in arg_name :
0 commit comments