diff --git a/server/api/schema.py b/server/api/schema.py index 453a1c45..f5e87a87 100644 --- a/server/api/schema.py +++ b/server/api/schema.py @@ -27,7 +27,7 @@ from users.mutations import ProfileMutations from registration.mutations_public import RegistrationMutations -class Query(UsersQuery, AllUsersQuery, ModuleRoomsQuery, RoomsQuery, ObjectivesQuery, BookQuery, AssignmentsQuery, +class CustomQuery(UsersQuery, AllUsersQuery, ModuleRoomsQuery, RoomsQuery, ObjectivesQuery, BookQuery, AssignmentsQuery, StudentSubmissionQuery, BasicKnowledgeQuery, PortfolioQuery, SurveysQuery, graphene.ObjectType): node = relay.Node.Field() @@ -35,11 +35,11 @@ class Query(UsersQuery, AllUsersQuery, ModuleRoomsQuery, RoomsQuery, ObjectivesQ debug = graphene.Field(DjangoDebug, name='_debug') -class Mutation(BookMutations, RoomMutations, AssignmentMutations, ObjectiveMutations, CoreMutations, PortfolioMutations, +class CustomMutation(BookMutations, RoomMutations, AssignmentMutations, ObjectiveMutations, CoreMutations, PortfolioMutations, ProfileMutations, SurveyMutations, NoteMutations, RegistrationMutations, SpellCheckMutations, CouponMutations, graphene.ObjectType): if settings.DEBUG: debug = graphene.Field(DjangoDebug, name='_debug') -schema = graphene.Schema(query=Query, mutation=Mutation) +schema = graphene.Schema(query=CustomQuery, mutation=CustomMutation) diff --git a/server/core/views.py b/server/core/views.py index e9040ba5..9d37bd55 100644 --- a/server/core/views.py +++ b/server/core/views.py @@ -1,15 +1,11 @@ import requests from django.conf import settings from django.contrib.auth.mixins import LoginRequiredMixin -from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, \ - PasswordResetCompleteView from django.http.response import HttpResponse from django.shortcuts import render -from django.urls import reverse_lazy from django.views.decorators.csrf import ensure_csrf_cookie from django.views.generic import TemplateView from graphene_django.views import GraphQLView -from django.utils.translation import gettext_lazy as _ from core.hep_client import HepClient from core.models import AdminData @@ -23,7 +19,10 @@ class PrivateGraphQLView(LoginRequiredMixin, GraphQLView): def home(request): if settings.SERVE_VIA_WEBPACK: try: - return HttpResponse(requests.get('http://localhost:8080/{}'.format(request.get_full_path())).text) + res = requests.get('http://localhost:8080/{}'.format(request.get_full_path())) + headers = res.headers + content_type = headers.get('content-type', 'text/html') + return HttpResponse(res.text, content_type=content_type) except Exception as e: print('Can not connect to dev server at http://localhost:8080:', e)