Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions graphene_sqlalchemy/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from graphene.relay import is_node
from graphene.types.json import JSONString

from .fields import SQLAlchemyConnectionField
from .fields import createConnectionField

try:
from sqlalchemy_utils import ChoiceType, JSONType, ScalarListType
Expand Down Expand Up @@ -36,7 +36,7 @@ def dynamic_type():
elif (direction == interfaces.ONETOMANY or
direction == interfaces.MANYTOMANY):
if is_node(_type):
return SQLAlchemyConnectionField(_type)
return createConnectionField(_type)
return Field(List(_type))

return Dynamic(dynamic_type)
Expand Down
12 changes: 12 additions & 0 deletions graphene_sqlalchemy/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,15 @@ def connection_resolver(cls, resolver, connection, model, root, args, context, i

def get_resolver(self, parent_resolver):
return partial(self.connection_resolver, parent_resolver, self.type, self.model)


__connectionFactory = SQLAlchemyConnectionField


def createConnectionField(_type):
return __connectionFactory(_type)


def registerConnectionFieldFactory(factoryMethod):
global __connectionFactory
__connectionFactory = factoryMethod