Use this tag for questions about Graphene-Django, integration features of Graphene (a framework for building GraphQL APIs) that are designed to make working with Django simple.
Questions tagged [graphene-django]
386 questions
4
votes
2 answers
Django graphene GraphiQL page not loading when running from Uvicorn
Not sure what I set wrong but I am not getting the graphiql interface when running in uvicorn using uvicorn mysite.asgi:application:
[32mINFO[0m: Started server process [[36m14872[0m]
[32mINFO[0m: Waiting for application…

ccsv
- 8,188
- 12
- 53
- 97
4
votes
0 answers
Cannot order by two fields using django filter in graphene-django
I am using DjangoFilterConnectionField in my project like this:
all_sessions = DjangoFilterConnectionField(SessionNode, filterset_class=AgendaFilter)
SessionNode is created based on Session model in my Django application. Now, I would like to be…

martasd
- 111
- 1
- 1
- 8
4
votes
1 answer
GraphQL multiple queries in one request in Django
Im using Django with graphene to build an API but i want to combine two models in one query, all the fields of the models are the same.
Example
schema.py
import graphene
from graphene_django import DjangoObjectType
from .models import Post,…

Filip Simin
- 538
- 1
- 6
- 23
4
votes
1 answer
GraphQL Mutation in Graphene for Object with Foreign Key Relation
I'm building a simple CRUD interface with Python, GraphQL (graphene-django) and Django. The CREATE mutation for an Object (Ingredient) that includes Foreign Key relations to another Object (Category) won't work. I want to give GraphQL the id of the…

tamara d
- 320
- 5
- 18
4
votes
0 answers
How to autodocument graphql query in graphene-django?
With graphene-django when documenting e.g. GraphQL object type classes the docstrings are usually used to autogenerate documentation which is visible in GraphiQL. This should also work with plain graphene-python and all graphene-python based…

thinwybk
- 4,193
- 2
- 40
- 76
4
votes
3 answers
Django Graphene Relay order_by (OrderingFilter)
I have a Graphene interface with Relay and filters. It works pretty well but I would like to add the order_by options. My objects look like:
class FooGQLType(DjangoObjectType):
class Meta:
model = Foo
exclude_fields =…

Eric Darchis
- 24,537
- 4
- 28
- 49
4
votes
2 answers
Invalid credentials raises exception on auth mutation
I'm using graphene-django and django-graphql-jwt in my django project. When I set invalid credentials server raises 'Invalid credentials' exception.
Are invalid credentials supposed to raise an exception on the server? When I test tokenAuth mutation…

cristhiam
- 496
- 1
- 4
- 17
4
votes
1 answer
What is the difference between graphene.Node and graphene.relay.Node?
I try to understand Graphql in django and use graphene and graphene_django.
My frontend will probably be built with Vuejs and Apollo client.
All the tutorials on the internet are about wether classic Graphql or Relay.
Relay with its Nodes and Edges…

Zogsha
- 63
- 6
3
votes
0 answers
Solved: In graphene-django, how do i return an errors list?
Can i raise an exception in a graphene.Mutation's mutate method so it gives an "errors" list in the GraphQL response?
This used to work in graphene-django 3.0.0b7:
class DeleteOrderlineMutation(graphene.Mutation):
Output = graphene.ID()
…

khink
- 81
- 4
3
votes
2 answers
Getting the error : ImportError: cannot import name 'to_const'
getting the following import error in my Django(graphene) application, is there a workaround ?
from graphene.utils.str_converters import to_camel_case, to_const
ImportError: cannot import name 'to_const'

bitbuoy
- 353
- 2
- 8
3
votes
0 answers
How can I make Graphene resolvers run concurrently
I have a graphene query that looks similar to below where I have more than 1 resolver function. These queries run sequentially per the Django debug toolbar. Even though these queries are not dependent on each-other. I've been digging through the…

anthony-dandrea
- 2,583
- 7
- 26
- 46
3
votes
1 answer
Django Graphene/GraphQL best design for model field-level permissions
I am using Django as back-end with graphene-django serving the front-end. I am new to both django and graphene so I am not sure what is the best approach to achieve field-level permissions with no code repetition in this set-up. For example, if my…

user9128309
- 165
- 11
3
votes
2 answers
How to get the current logged-in user for schema? (django graphql api)
my goal: I am trying to return all the fields of the posts if the user has an id of 1, and I want to return only 3 fields if else.
My problem is: in the query or mutations I can do info.context.user.id but in the schema I can't do that.
Here in my…

Ali Husham
- 816
- 10
- 31
3
votes
1 answer
Using @login_required for queries/mutations in django-graphql-jwt leads to graphql.error.located_error.GraphQLLocatedError
I'm a begginer with GraphQL and started developing a small app using Django and decided to use django-graphql-jwt for authentication.
I can use the getTokenAuth, VerifyToken and RefreshToken with no problem. But when I try to use a query with…

Jocho Delgado
- 103
- 1
- 1
- 8
3
votes
1 answer
Django Graphene writing mutations with multiple layers of nested foreign keys
How do you write the schema and query for nested foreign keys? I checked the docs and found no examples of how to do this. So here was my attempt based on github and stackoverflow answers lets say I have these models:
class Address(models.Model):
…

ccsv
- 8,188
- 12
- 53
- 97