mirror of
https://github.com/evgen-app/evg-app-back.git
synced 2024-11-22 08:46:34 +03:00
82 lines
1.8 KiB
Python
82 lines
1.8 KiB
Python
import graphene_django
|
|
from .models import Organisation, Role, Group, Teacher, Child, Organisator
|
|
from graphene import relay
|
|
import graphene
|
|
|
|
print(Teacher, Child)
|
|
|
|
class OrganisatorType(graphene_django.DjangoObjectType):
|
|
class Meta:
|
|
model = Organisator
|
|
interfaces = (relay.Node,)
|
|
filter_fields = {
|
|
"name": ("exact", "contains"),
|
|
"surname": ("exact", "contains"),
|
|
"midname": ("exact", "contains"),
|
|
"org" : ("exact",),
|
|
"profile" : ("exact",),
|
|
"groups" : ("contains",)
|
|
}
|
|
|
|
class OrganisationType(graphene_django.DjangoObjectType):
|
|
class Meta:
|
|
model = Organisation
|
|
interfaces = (relay.Node,)
|
|
filter_fields = {
|
|
"name" : ("exact", "contains",),
|
|
}
|
|
|
|
class RoleType(graphene_django.DjangoObjectType):
|
|
class Meta:
|
|
model = Role
|
|
|
|
|
|
class TeacherType(graphene_django.DjangoObjectType):
|
|
class Meta:
|
|
model = Teacher
|
|
interfaces = (relay.Node,)
|
|
|
|
filter_fields = {
|
|
"name": ("exact", "contains"),
|
|
"surname": ("exact", "contains"),
|
|
"midname": ("exact", "contains"),
|
|
"org" : ("exact",),
|
|
"profile" : ("exact",),
|
|
"groups" : ("contains",)
|
|
}
|
|
pk = graphene.Int()
|
|
|
|
def resolve_pk(self, info): return self.pk
|
|
|
|
|
|
class ChildType(graphene_django.DjangoObjectType):
|
|
class Meta:
|
|
model = Child
|
|
|
|
interfaces = (relay.Node,)
|
|
|
|
filter_fields = {
|
|
"name": ("exact", "contains"),
|
|
"surname": ("exact", "contains"),
|
|
"midname": ("exact", "contains"),
|
|
"org" : ("exact",),
|
|
"profile" : ("exact",),
|
|
"groups" : ("contains",)
|
|
}
|
|
pk = graphene.Int()
|
|
|
|
def resolve_pk(self, info): return self.pk
|
|
|
|
|
|
class GroupType(graphene_django.DjangoObjectType):
|
|
class Meta:
|
|
model = Group
|
|
interfaces = (relay.Node,)
|
|
|
|
filter_fields = {
|
|
"name" : ("exact", "contains"),
|
|
}
|
|
pk = graphene.Int()
|
|
|
|
def resolve(self, info):
|
|
return self.pk |