From b281bff226ae8f0575ade36800183f087a22679e Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Fri, 22 Jan 2016 21:18:20 -0800 Subject: [PATCH] Added global_id method to Nodes --- graphene/relay/types.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/graphene/relay/types.py b/graphene/relay/types.py index 5dbae954..06732735 100644 --- a/graphene/relay/types.py +++ b/graphene/relay/types.py @@ -125,9 +125,13 @@ class Node(six.with_metaclass(NodeMeta, Interface)): class Meta: abstract = True + @classmethod + def global_id(cls, id): + type_name = cls._meta.type_name + return to_global_id(type_name, id) + def to_global_id(self): - type_name = self._meta.type_name - return to_global_id(type_name, self.id) + return self.global_id(self.id) connection_type = Connection edge_type = Edge