@@ -16,14 +16,24 @@ def model(self):
16
16
return self .type ._meta .node ._meta .model
17
17
18
18
@classmethod
19
- def get_query (cls , model , context , info , args ):
20
- return get_query (model , context )
19
+ def get_query (cls , model , info , ** args ):
20
+ return get_query (model , info .context )
21
+
22
+ @property
23
+ def type (self ):
24
+ from .types import SQLAlchemyObjectType
25
+ _type = super (ConnectionField , self ).type
26
+ assert issubclass (_type , SQLAlchemyObjectType ), (
27
+ "SQLAlchemyConnectionField only accepts SQLAlchemyObjectType types"
28
+ )
29
+ assert _type ._meta .connection , "The type {} doesn't have a connection" .format (_type .__name__ )
30
+ return _type ._meta .connection
21
31
22
32
@classmethod
23
- def connection_resolver (cls , resolver , connection , model , root , args , context , info ):
24
- iterable = resolver (root , args , context , info )
33
+ def connection_resolver (cls , resolver , connection , model , root , info , ** args ):
34
+ iterable = resolver (root , info , ** args )
25
35
if iterable is None :
26
- iterable = cls .get_query (model , context , info , args )
36
+ iterable = cls .get_query (model , info , ** args )
27
37
if isinstance (iterable , Query ):
28
38
_len = iterable .count ()
29
39
else :
0 commit comments