Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在graphene django解析方法中访问经过身份验证的用户?_Django_Graphene Django - Fatal编程技术网

如何在graphene django解析方法中访问经过身份验证的用户?

如何在graphene django解析方法中访问经过身份验证的用户?,django,graphene-django,Django,Graphene Django,我已经将它添加到我的查询类中,它将返回null作为响应 me = graphene.Field(UserType) def resolve_user(root, info): logger.info("***** Inside resolve ****") return info.context.user 我的UserType定义如下 class UserType(DjangoObjectType): fields = ["id", "name", "email",

我已经将它添加到我的
查询
类中,它将返回null作为响应

me = graphene.Field(UserType)

def resolve_user(root, info):
    logger.info("***** Inside resolve ****")
    return info.context.user
我的
UserType
定义如下

class UserType(DjangoObjectType):
    fields = ["id", "name", "email", "username"]

    class Meta:
        model = User
我使用的是Django==3.0,如果有帮助的话


我通过了认证,饼干也在。它甚至没有打印日志,这让我很困惑。

石墨烯字段使用
解析模式解析值。检查更多


石墨烯字段使用
解析
模式解析值。检查更多

me = graphene.Field(UserType)
^^

def resolve_me(root, info):
    logger.info("***** Inside resolve ****")
    return info.context.user