django -石墨烯和树形结构输出



是否有可能在django-graphene的帮助下制作以下类型的树形结构输出?

"mainMenu": [
{
"pageSlug": "page-slug-01",
"pageTitle": "page-title-01",
"children": [
{
"pageSlug": "sub_page-slug-01",
"pageTitle": "sub_page-title-01",
"children": [
...
]
},
...
{
"pageSlug": "sub_page-slug-N",
"pageTitle": "sub_page-title-N",
"children": [
...
]
},
]
},
...
{
"pageSlug": "page-slug-N",
"pageTitle": "page-title-N",
"children": [
...
]
},
]

我想不出如何描述这些类

1)创建schema . py

<标题>schema.py h1>urls . py
from django.urls import path
from graphene_django.views import GraphQLView
from .schema import schema
urlpatterns = [
path('graphql', GraphQLView.as_view(graphiql=True, schema=schema)),
]

相关内容

  • 没有找到相关文章

最新更新