title: GraphQL queries in Django returning None
body: <p>I am trying to use graphQL queries in django. Basically I have two apps, my 'api' app which contains everything I need to make the queries and another one called 'frontend' from which I call the api to use these queries.</p>
  <p>I can use the GraphQL view to type queries in it and it works perfectly, but whenever I try to make the query, I get this: &quot;OrderedDict([('users', None)])&quot;</p>
  <p><a href="https://i.stack.imgur.com/1Jzsb.png" rel="nofollow noreferrer">Result of my query in the GraphQl view</a></p>
  <p>The code:</p>
  <p>In 'api' my <strong>schema.py</strong>:</p>
  <pre><code>import graphene
  import graphql_jwt
  from graphene import relay, ObjectType, AbstractType, List, String, Field,InputObjectType
  from graphene_django import DjangoObjectType
  from graphene_django.filter import DjangoFilterConnectionField
  from datetime import date, datetime
  from django.contrib.auth.models import User
  from django.contrib.auth import get_user_model
  
  ....
  
  class Query(graphene.ObjectType):
      me = graphene.Field(UserType)
      users = graphene.List(UserType)
      profile = relay.Node.Field(ProfileNode)
      all_profiles = DjangoFilterConnectionField(ProfileNode)
  
      def resolve_users(self, info):
          ### Returns all users ###
          user = info.context.user
          if user.is_anonymous:
              raise Exception('Not logged!')
          if not user.is_superuser:
              raise Exception('premission denied')
          return User.objects.all()
  
      def resolve_me(self, info):
          ### Returns logged user ###
          user = info.context.user
          if user.is_anonymous:
              raise Exception('Not logged!')
          return user
  
      def resolve_all_profiles(self, info, **kwargs):
          ### Returns all profiles ###
          return Profile.objects.all()
  
  .....
  
  def execute(my_query):
      schema = graphene.Schema(query=Query)
      return schema.execute(my_query)
  </code></pre>
  <p>And the <strong>views.py</strong> that calls the app 'api' in my app frontend:</p>
  <pre><code>from django.shortcuts import render
  import graphene
  from api import schema
  from django.contrib.auth import authenticate
  
  
  def accueil(request):
  
      if request.user.is_authenticated:
          check = &quot;I am logged&quot;
      else:
          check = &quot;I am not logged&quot;
  
      result = schema.execute(&quot;&quot;&quot;query {
                                  users {
                                      id
                                      username
                                  }
                              }&quot;&quot;&quot;)
  
      return render(request, 'frontend/accueil.html', {'result' : result.data, 'check' : check})
  </code></pre>
  <p><strong>The template :</strong></p>
  <pre><code>&lt;h1&gt;OTC&lt;/h1&gt;
  &lt;p&gt; the users are : {{result}}&lt;/p&gt;
  &lt;br/&gt;
  &lt;p&gt;{{check}}&lt;/p&gt;
  &lt;a href=&quot;{%url 'login'  %}&quot;&gt;login&lt;/a&gt;
  &lt;a href=&quot;{%url 'logout' %}&quot;&gt;logout&lt;/a&gt;
  </code></pre>
  <p>and finally:</p>
  <p><strong><a href="https://i.stack.imgur.com/XUvvv.png" rel="nofollow noreferrer">The web page result</a></strong></p>
  <p>and the error in the console:</p>
  <pre><code>An error occurred while resolving field Query.users
  Traceback (most recent call last):
    File &quot;/home/victor/myenv/lib/python3.5/site-packages/graphql/execution/executor.py&quot;, line 311, in resolve_or_error
      return executor.execute(resolve_fn, source, info, **args)
    File &quot;/home/victor/myenv/lib/python3.5/site-packages/graphql/execution/executors/sync.py&quot;, line 7, in execute
      return fn(*args, **kwargs)
    File &quot;/home/victor/poc2/poc2/api/schema.py&quot;, line 67, in resolve_users
      user = info.context.user
  AttributeError: 'NoneType' object has no attribute 'user'
  Traceback (most recent call last):
    File &quot;/home/victor/myenv/lib/python3.5/site-packages/graphql/execution/executor.py&quot;, line 330, in complete_value_catching_error
      exe_context, return_type, field_asts, info, result)
    File &quot;/home/victor/myenv/lib/python3.5/site-packages/graphql/execution/executor.py&quot;, line 383, in complete_value
      raise GraphQLLocatedError(field_asts, original_error=result)
  graphql.error.located_error.GraphQLLocatedError: 'NoneType' object has no attribute 'user'
  </code></pre>