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
2
votes
1 answer
validate and handle error to pass meaningful status back to client
I am using graphene-django instead of rest api(rest framework). I am working on user registration. In the rest framework, validation was done in serializers part but when using graphene how do i validate and handle error for passing meaningful…

Serenity
- 3,884
- 6
- 44
- 87
2
votes
0 answers
How do I expose Wagtail search in a Django Graphene query?
Given the general structure:
class Article(Page):
body = RichTextField(...)
search_fields = Page.search_fields + [index.SearchField('body')]
class ArticleFilter(FilterSet):
search = SearchFilter()
class Meta:
model = Article
fields…

noahnu
- 3,479
- 2
- 18
- 40
2
votes
1 answer
Unable to login with provided credentials
I am trying to automatically login the user when user signs up instead of redirecting to login page and then only login. However, I get an error
"errors": [
"email",
"Unable to login with provided credentials."
],
Here is what I have…

milan
- 2,409
- 2
- 34
- 71
1
vote
0 answers
Django - working example of graphene aiodataloader
I've been looking into using a DataLoader in Django to optimise Graphene resolvers. I have been having trouble finding a working example of this as it requires multi threading. Based on what I can tell, there is no longer a way to specify executors…

Sthe
- 2,575
- 2
- 31
- 48
1
vote
0 answers
How to fill GraphQL ENUM from Django QuerySet?
In my graphql API for Revenue field use Currency enum from constant.
from graphene import Enum
CurrencyEnum = Enum('Currency', CURRENCY_CHOICES)
class RevenueMetrics:
revenue = graphene.Float(description='Revenue',…

Danialgo
- 11
- 3
1
vote
0 answers
What does Django do between authentication and view dispatch?
I am trying to diagnose some performance issues I'm having with Django (3.2.18), Graphene (2.1.8), and Graphene-Django (2.14.0) using datadog. I'm also using gunicorn as my web server and postgres as my db.
When looking at the trace for some oddly…

user1778403
- 41
- 2
1
vote
0 answers
Mutation in django graphene for model with foreign key and many to many relationship
I have 2 models in my django app, the first is Tags model and the second is Post model, the problem is when i try to use mutation for the Post model to add a post from the graphql it doesn't work but it works fine in the Tags model, also the Queries…

B14ck Dz
- 11
- 1
1
vote
0 answers
ModuleNotFoundError: No module named 'graphene_django' error when integrating GraphQL into the project
I got ModuleNotFoundError: No module named 'graphene_django' error after I added 'graphene_django' in settings.py and run the python manage.py runserver command.
I installed django, graphene-django using pip but no use.
I tried with virtual env and…

Usha Rani
- 11
- 2
1
vote
1 answer
Why am I getting a "Cannot return null for non-nullable field" error when doing a query?
**FOLDER STRUCTURE
**
models.py
import graphene
from graphene import ObjectType, relay
from graphene_django import DjangoObjectType
from general.models import Character, Director, Episode
class CharacterType(DjangoObjectType):
pk =…

HarilalAV
- 41
- 1
- 7
1
vote
1 answer
TypeError: Query fields cannot be resolved. The type QuestionnaireType doesn't have a connection
I have the following schema:
class Query(graphene.ObjectType):
all_questionnaires = DjangoFilterConnectionField(QuestionnaireType)
I got the error when running the tests
TypeError: Query fields cannot be resolved. The type QuestionnaireType…

Rodrigo
- 135
- 4
- 45
- 107
1
vote
0 answers
Is there a way for graphene to accept plain text?
When I send a query with Content-Type as plain text, I keep getting a
{"errors":[{"message":"Must provide query string."}]}
When I convert the query to a JSON object and change the content-type to json, which is painful to do tbh, it works fine.…

user133688
- 6,864
- 3
- 20
- 36
1
vote
0 answers
How to filter custom field in graphene django?
from graphene_django import DjangoObjectType
from .models import Question
class QuestionType(DjangoObjectType):
class Meta:
model = Question
fields = ("id", "question_text")
extra_field = graphene.String()
def…

John Fernando
- 57
- 4
1
vote
1 answer
Graphene: customizing how Enum is serialized
Our backend uses SQLAlchemy as our ORM, and I've recently been playing around with exposing a graphql API, but am having a hard time figuring out how to customize how Enum is serialized by graphene.
Our SqlAlchemy objects all inherit from a…

msmedes
- 41
- 3
1
vote
0 answers
Dajngo all migrations are doubled
I just started my django project and after running the migrations I was trying to create superuser. Then the error popped out that I have unapplied migrations (even though I just did it). When I checked the "showmigrations" it turned out that all…

MartynaMajch
- 118
- 1
- 1
- 10
1
vote
1 answer
unresponsive mutation on graphql
When I am injecting values on useMutation it gives me Error 400 140. The data types does match. In appointment_booking argument, I am passing the its ID as a reference on the other table.
Here is my Schema
class…