75 lines
1.3 KiB
Python
75 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
import os
|
|
import sys
|
|
|
|
import django
|
|
import graphene
|
|
from graphene import Context
|
|
|
|
sys.path.append("../server")
|
|
|
|
os.environ.setdefault("IT_APP_ENVIRONMENT", "local")
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.base")
|
|
django.setup()
|
|
|
|
from vbv_lernwelt.core.models import User
|
|
from vbv_lernwelt.core.schema import Query
|
|
|
|
|
|
def main():
|
|
from django.conf import settings
|
|
|
|
settings.DEBUG = True
|
|
from django.db import connection, reset_queries
|
|
|
|
reset_queries()
|
|
|
|
schema = graphene.Schema(query=Query, auto_camelcase=False)
|
|
context = Context()
|
|
context.user = User.objects.get(username="admin")
|
|
result = schema.execute(
|
|
"""
|
|
{
|
|
learning_path(slug: "überbetriebliche-kurse-lp") {
|
|
id
|
|
title
|
|
content_type
|
|
topics {
|
|
id
|
|
title
|
|
content_type
|
|
circles {
|
|
id
|
|
title
|
|
content_type
|
|
learning_sequences {
|
|
id
|
|
title
|
|
icon
|
|
learning_units {
|
|
id
|
|
title
|
|
learning_contents {
|
|
id
|
|
title
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
""",
|
|
context=context,
|
|
)
|
|
|
|
print(result)
|
|
print(len(connection.queries))
|
|
|
|
# reference
|
|
reset_queries()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|