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
3
votes
1 answer
'DjangoFormMutationOptions' object has no attribute 'model'
I am trying to create a mutation using DjangoFormMutation, I am getting an error that DjangoFormMutationOptions has no attribute 'model', here is the error that I am getting.
{
"errors": [
{
"message": "'DjangoFormMutationOptions' object…

Shaphan
- 1,003
- 11
- 10
3
votes
2 answers
How to mock info.context in Django / Graphene tests
Problem
I'm trying to test a graphql query. The query requires that the user associated with the request (info.context.user) is a super user (.is_superuser). Otherwise it throws an exception. I'm trying to test that the query works properly but am…

David Thompson
- 43
- 1
- 8
3
votes
0 answers
In Django, how can the Graphene GraphQL endpoint be protected for API usage?
Graphene provides a GraphQL integration into Django and supplies a view to create a URL endpoint. The question is how can the endpoint be protected for API usage? The recommend method is to use a LoginRequiredMixin which is great for logged in…

Moritz
- 2,987
- 3
- 21
- 34
3
votes
0 answers
How to upload file with graphql and graphene
I'm trying to upload a file using graphql and graphene.
On frontend I have fetch request as follows:
fetch(
'/graphql', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
…

Boky
- 11,554
- 28
- 93
- 163
3
votes
1 answer
how to use custom register mutation with django-graphql-auth
django-graphql-auth is an awesome package, but the documentation doesn't say much about models association to a custom user model.
I am looking for a away to make use of this package with a custom Register Mutation for both user types Applicant and…

seddka
- 105
- 12
3
votes
1 answer
Django-graphene multiple types for the same model
I have a quite big graphene-django API which feeds two applications.
My first approach to restrict access to some fields was to have multiple DjangoObjectTypes for the same model, and use fields to limit which fields can be accessed on each…

Christian Bouvier
- 433
- 3
- 10
3
votes
0 answers
Graphene Django Super Slow Performance
Currently, we're using Graphene-Django API on an Azure Virtual Machine that's running Ubuntu 18.04 LTS and Maria DB. We also have a React client that runs in a WordPress environment that interacts with this API. The client uses the Apollo boost…

cardelio
- 31
- 2
3
votes
1 answer
How to get Django Graphene ModelForm Mutation to apply
I'm trying to make this mutation create a new record in the database. It returns code 200 but no change to the database plus it returns null.
The documentation is not clear on this issue.(ModelForm vs mutate function)
Graphql response:
{
"data":…

Alan Karanja
- 51
- 1
- 3
3
votes
2 answers
how to add a custom field that is not present in database in graphene django
so my model looks like
class Abcd(models.Model):
name = models.CharField(max_length=30, default=False)
data = models.CharField(max_length=500, blank=True, default=False)
need to pass a dictionary at query time which is not a part of model,…

nish
- 1,008
- 4
- 17
- 34
3
votes
2 answers
Does a graphene django Endpoint expects a X-Csrftoken and CsrfCookie at the same time?
Using:
Django 3.x [ Django-Filters 2.2.0, graphene-django 2.8.0, graphql-relay 2.0.1 ]
Vue 2.x [ Vue-Apollo ]
I am testing single page vue app´s with Django, GraphQL & Vue-Apollo.
If i use csrf_exempt on my view everything works in the frontend.…

black_hole_sun
- 908
- 11
- 41
3
votes
1 answer
Is there any way to remove edges and node when using DjangoFilterConnectionField?
i started to use graphene with django and for right now i don't need all that overhead of edges and node,
i know it's for pagination but right now i only need the fields of my model.
To be clear, i still want to be able to use filterset i just dont…

ריף הורביץ
- 31
- 1
- 1
3
votes
0 answers
How to develop a global Mutation class to perform an ADD Operation in Graphene-Django using GraphQL?
Can anyone share how to develop a global Mutation class to perform an ADD Operation in Graphene-Django using GraphQL? I can write separate Mutations for individual Models but I want to use the main Mutation Class and want to reuse that passing my…

BlueSky
- 41
- 2
3
votes
1 answer
graphql-django update mutation with optional fields idiom?
When implementing GraphQL update mutations with many (here just a and b) optional InputObjectType fields it generates a lot of boilerplate to check if the InputObjectTypes fields have been passed. Is there some idiom which is considered best…

thinwybk
- 4,193
- 2
- 40
- 76
3
votes
0 answers
How can I implement a custom mapping of a django model to a graphene-django type?
In Django 3.0.2 I've defined a model like the following one in /model.py:
from django.db import models
from django.utils.translation import gettext_lazy as _
class Something(models.Model):
class UnitPrefix(models.TextChoices):
…

thinwybk
- 4,193
- 2
- 40
- 76
3
votes
2 answers
Django Form in VueJS component template
I'm currently starting a project in which I'm using Django for the backend, graphql (Graphene) for the API, VueJS for the frontend, and Vue Apollo to ease running graphql queries through VueJS.
The thing is :
I'm already able to do custom forms in…

lbris
- 1,068
- 11
- 34