18 lines
446 B
Python
18 lines
446 B
Python
import graphene
|
|
from graphene import relay
|
|
|
|
|
|
class ModuleInterface(relay.Node):
|
|
pk = graphene.Int()
|
|
hero_image = graphene.String(required=True)
|
|
topic = graphene.Field('books.schema.nodes.TopicNode')
|
|
|
|
@staticmethod
|
|
def resolve_pk(parent, info, **kwargs):
|
|
return parent.id
|
|
|
|
@staticmethod
|
|
def resolve_hero_image(parent, info, **kwargs):
|
|
if parent.hero_image:
|
|
return parent.hero_image.file.url
|