Questions tagged [graphene-django]

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.

386 questions
2
votes
1 answer

How to authenticate with django-grahql-jwt in a graphene-django GraphQLTestCase?

I'm trying to test my mutation according to graphene django documentation. the mutation works with @login_required decorator and there's a problem because any method of login to test doesn't work. I tried with self.client.login,…
Sevy
  • 93
  • 10
2
votes
2 answers

can't get the value of OneToOne relationship queries in graphene_django

The default django User model have been extended using OneToOne link (some extra fields added to it). Here is my model: class Driver(models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE ) …
Mostafa Ghadimi
  • 5,883
  • 8
  • 64
  • 102
2
votes
1 answer

Graphene-Django create multiple instances

Let's say I've got a models.py with two tables: class Category(models.Model): cat = models.CharField(max_length=100) class Thing(models.Model): desc = models.CharField(max_length=100) category = models.ForeignKey(Category,…
ZmuA
  • 151
  • 1
  • 13
2
votes
1 answer

How to update the model with the foreignkey relation in Graphene-Django Relay?

I'm tryting to create the Update mutation of the model that has a foreign key relation. I have done everything as per the documentation but it still doesn't work when I provide the foreign Model Input. I created the Input with the proper attributes…
Velidan
  • 5,526
  • 10
  • 48
  • 86
2
votes
1 answer

Cache update in a many 2 many relation

I'm using a combination of Django, GraphQL (graphene-django), VueJS and Apollo Client for my project. Everything is working fine until I tried to manage many2many relations. Usually when I make an update mutation to an object that is already in the…
lbris
  • 1,068
  • 11
  • 34
2
votes
1 answer

How can I accept a dictionary/object as input in a graphene(GraphQL) mutation?

mutation{ createPayment(p_obj={"bob": 80, "job": 100}){ } } What I could find was to accept a list of objects as input like: [ {username: "bob", "amount": 80}, {username: "job", "amount": 100} ]
2
votes
1 answer

graphene-django: Query all the models fields and not the requested fields

I have two models: class Type(models.Model): name = models.CharField(max_length=255) def __str__(self): return f'{self.name}' class Pet(models.Model): name = models.CharField(max_length=255) color =…
Agu Aguilar
  • 191
  • 3
  • 11
2
votes
1 answer

How to handle properly handle graphene error?

I am in the early period of graphene-django. I have Mutation like this class DeleteObjection(graphene.Mutation): """ 1. Authorized User only 2. His own `Objection` only 3. Be able to delete only `Hidden type Objection` """ ok…
joe
  • 8,383
  • 13
  • 61
  • 109
2
votes
1 answer

Django GraphQL returns null

I have a Django GraphQL app (graphene_django) running with djongo (mongoDB). When I try to list all twitter queries (with GraphiQL), it returns null data : My query : query { allTwitterQueries { id, keyword } } Returns : { "data": { …
altab
  • 25
  • 6
2
votes
1 answer

How can I ignore unknown arguments passed as inputs to a mutation?

As per the GraphQL spec https://graphql.github.io/graphql-spec/draft/#sec-Input-Objects the input object literal or unordered map must not contain any entries with names not defined by a field of this input object type, otherwise an error must be…
2
votes
1 answer

Return initial data on subscribe event in django graphene subscriptions

I'm trying to response to user on subscribe. By example, in a chatroom when an user connect to subscription, the subscription responses him with data (like a welcome message), but only to same user who just connect (no broadcast). How can I do that?…
2
votes
0 answers

graphene could not convert string to float in SerializerMutation

Is the SerializerMutation suppose to convert ID! from base64 to a pk? Is there some frontend/backend helper util to assist in conversion? I haven't been able to find anything specific. Example create thing mutation: class…
jmunsch
  • 22,771
  • 11
  • 93
  • 114
2
votes
1 answer

return django model property field in graphene graphql query

How to add a @property field from a django model graphql results?: class MyModel(...): ... @property def some_property(self): return 'property here' class MyObject(DjangoObjectType): class Meta: model = MyModel …
jmunsch
  • 22,771
  • 11
  • 93
  • 114
2
votes
2 answers

Graphene Django File field get absolute path

I have an image field in my Django model and I am trying to get absolute path of the image field output from Graphene so as to connect to my client. class ProfileType(DjangoObjectType): class Meta: model = Profile def…
Udemezue John
  • 128
  • 2
  • 12
2
votes
2 answers

Graphene-Django Relay Cursor Based Pagination Does Not Work for Dynamic Data

I am fetching dynamic data using Graphene-Django Relay specification. import graphene from graphene_django.types import DjangoObjectType from graphene_django.fields import DjangoConnectionField from . import models class…
Grateful
  • 383
  • 5
  • 18