Skip to content

Commit b281bff

Browse files
committed
Added global_id method to Nodes
1 parent a0ac884 commit b281bff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

graphene/relay/types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ class Node(six.with_metaclass(NodeMeta, Interface)):
125125
class Meta:
126126
abstract = True
127127

128+
@classmethod
129+
def global_id(cls, id):
130+
type_name = cls._meta.type_name
131+
return to_global_id(type_name, id)
132+
128133
def to_global_id(self):
129-
type_name = self._meta.type_name
130-
return to_global_id(type_name, self.id)
134+
return self.global_id(self.id)
131135

132136
connection_type = Connection
133137
edge_type = Edge

0 commit comments

Comments
 (0)