mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-30 05:23:57 +03:00
35 lines
569 B
Python
35 lines
569 B
Python
|
from django.conf.urls import url
|
||
|
|
||
|
from graphene.contrib.django.views import GraphQLView
|
||
|
|
||
|
from graphene import Schema
|
||
|
from graphene.contrib.django.types import (
|
||
|
DjangoNode,
|
||
|
DjangoInterface
|
||
|
)
|
||
|
|
||
|
from .models import Reporter, Article
|
||
|
|
||
|
|
||
|
class Character(DjangoNode):
|
||
|
class Meta:
|
||
|
model = Reporter
|
||
|
|
||
|
def get_node(self, id):
|
||
|
pass
|
||
|
|
||
|
|
||
|
class Human(DjangoNode):
|
||
|
class Meta:
|
||
|
model = Article
|
||
|
|
||
|
def get_node(self, id):
|
||
|
pass
|
||
|
|
||
|
schema = Schema(query=Human)
|
||
|
|
||
|
|
||
|
urlpatterns = [
|
||
|
url(r'^graphql', GraphQLView.as_view(schema=schema)),
|
||
|
]
|