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 make Many-to-many mutations in Django-Graphene?

I'm working in Django 3.2 and graphene-django 2.15. I'm still learning how to use Graphene by the way. Note: I'm not allowed to share all the code so I rewrote it for the purpose of this question. Please notify me if you've found any error unrelated…
Bravo2bad
  • 530
  • 1
  • 7
  • 25
2
votes
0 answers

How to combine DjangoObjectType and an additional field in one query?

I have a DjangoObjectType class and its query as below. class ExampleType(DjangoObjectType): class Meta: model = Example interfaces = (relay.Node,) order_number = String() group = String() def…
Aslı Kök
  • 616
  • 8
  • 19
2
votes
1 answer

How to solve 'NoneType' object has no attribute 'fields' in Graphene-django

Have this mutation class AddStudentMutation(graphene.Mutation): class Arguments: input = StudentInputType() student = graphene.Field(StudentType) @classmethod @staff_member_required def mutate(cls, root, info,…
K.Nehe
  • 424
  • 10
  • 22
2
votes
0 answers

Django Graphene (GraphQL) Filter on ManyToMany

I am working on an application using Django. We've exposed the models using Graphene. We have the following models: class Agent(models.Model): id = models.UUIDField(default=uuid.uuid4, unique=True, primary_key=True, editable=False) name =…
Jeroen Beljaars
  • 137
  • 1
  • 10
2
votes
1 answer

Return Django ORM union result in Django-Graphene

I am trying to query two separate objects and return them as a single result set. I've tried using a Union and an Interface, but not sure what I'm doing wrong there. My model: class BaseActivity(models.Model): class Meta: abstract =…
OpenDataAlex
  • 1,375
  • 5
  • 19
  • 39
2
votes
2 answers

Set permissions on Graphene Relay Node and Connection fields

How can I require authentication/authorization on the tier Node field and allTiers Connection field query below? # schema.py class TierNode(DjangoObjectType): class Meta: model = Tier filter_fields = [] interfaces =…
atm
  • 1,684
  • 1
  • 22
  • 24
2
votes
2 answers

Using arguments to nested structures for filtering parents using django-graphene

I'm currently using Python & Django with Graphene to model my Graphql backend. My question is similar to this one on Graphene's repo https://github.com/graphql-python/graphene/issues/431. I'm also using graphene_django_optimizer library to improve…
2
votes
0 answers

Using Django's GenericForeignKey with Async Graphene Subscription

I've implemented graphql_ws to subscribe to updates from a Notification model that uses multiple GenericForeignKeys. My setup works well, except when I try to query information from those foreign objects. I then get the following…
2
votes
1 answer

How to limit the number of items of a ForeignKey field when I'm fetching an object in Django GraphQL API using Graphene?

I have a simple chat application with a GraphQL API written in Django with Graphene plugin. And an Angular UI with Apollo as the GraphQL client. I have a chat model that is like chat rooms and a chatMessage model that is more of the individual…
Ragav Y
  • 1,662
  • 1
  • 18
  • 32
2
votes
1 answer

Django-Graphene: On a model ChoiceField, graphene expects a Type but got a value

On Django-Graphene, I have this model: class Entry(models.Model): STATE_CHOICES = [ ("Open", "Open"), ("Processing", "Processing"), ("Closed", "Closed"), ("Deleted", "Deleted"), ] # ... state =…
Bravo2bad
  • 530
  • 1
  • 7
  • 25
2
votes
1 answer

django-graphql-jwt with django-phone-field Object of type PhoneNumber is not JSON serializable

I'm currently using the django-phone-field library in a project where I use graphene-django as well. Here's my custom User model, where I'm using the PhoneField. class User(AbstractBaseUser, PermissionsMixin): """ Custom User model to add…
2
votes
0 answers

how to make Mutation by graphene-django when there are no input, output?

when user click button, I want to update A(Stock) DB by using data from B(Account) DB. when user click button, django get data(company_id and company_secret) From Account DB. and then web scraping with data. it makes new data. i want to just save…
liamstory
  • 57
  • 1
  • 4
2
votes
1 answer

DjangoListField analouge for an individual object resolver

I am using Django + GraphQL and it is extremely convenient to use DjangoListField. It allows me to override get_queryset at the ObjectType level and make sure all permissions verified there. In that manner I have a single place to have all my…
Andrii Zarubin
  • 2,165
  • 1
  • 18
  • 31
2
votes
2 answers

DjangoFilterConnectionField query for all records

I'm using DjangoFilterConnectionField with a django-graphene and django-filter. and I'd like to know if it's possible to get all the records via a query? Consider the following code: class Query(graphene.AbstractType): txt =…
Dory Zidon
  • 10,497
  • 2
  • 25
  • 39
2
votes
0 answers

With Graphene GraphQL, is it possible to cache the queryset used for Relay Connections (pagination)?

When using Graphene's Relay Connection field, it's very easy to paginate though a queryset. The client passes the arguments (first, after, before, last), then by returning a queryset the resolver paginates automatically. To me, a super powerful…
MDalt
  • 1,681
  • 2
  • 24
  • 46