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
0
votes
1 answer

Best approach to create a global search field for a postgres table in Django based GraphQL API?

I am working with an Angular UI with a Django-graphene GraphQL API and a postgres db. Currently I have implemented a functionality to arrive at a global search field by adding a "searchField" for each table and updating it with each create and…
Ragav Y
  • 1,662
  • 1
  • 18
  • 32
0
votes
1 answer

Django - How to implement a search box

I'm struggling to implement a search bar and could really do with a few suggestions on how it could be done. I'm quite a novice, so please bear with me. My difficulties lie more with the general understanding of what needs to be built than with a…
Liam
  • 3
  • 2
0
votes
1 answer

How to use OR condition for icontains in multiple fields with graphene-django

I have the following model in Django: class JobPost(models.Model): company = models.CharField(blank=True, max_length=30, null=True) job = models.CharField(blank=True, max_length=30, null=True) category = models.CharField(blank=True,…
0
votes
1 answer

search/filter with list of string graphene-django

I am looking to search for list of different characters/string using graphene-django with single search query run. class Query(graphene.ObjectType): candidateInfo = graphene.List(CandidateType, search=graphene.String(), …
a-k
  • 41
  • 5
0
votes
1 answer

how to prefetch directly unrelated fields in graphene django

I started using graphene and there are some thing I have not yet understood well for instance, when using nodes the I have this query { orders { edges { node { id fromUser { id username …
kim
  • 159
  • 12
0
votes
1 answer

How to map graphene.InputObjectType fields to kwargs?

Let's say we have InputObjectType: class OfficeInput(graphene.InputObjectType): orderNumber = graphene.Int(required=True) name = graphene.String() streetAddress = graphene.String() postalCode = graphene.String() city =…
Viljami
  • 639
  • 7
  • 15
0
votes
1 answer

Django ForeignKey field ignored by graphene-django when "to" value is a string

Versions: Python: 3.8 Django: 3.2.2 graphene-django: 2.15.0 The below issue worked was observed after upgrading to Django 3.2.2 from a 3.0 version. I have an issue when using graphene-django with a ForeignKey field, it is ignored because the value…
Daniel
  • 21
  • 4
0
votes
1 answer

Issue joining data in graphene-django with a ManyToMany field

I've been trying to find a good example for returning a query set with joined data across a ManyToMany field, but I've not found one. Given the following model: class Task(models.Model): id = models.UUIDField(primary_key=True,…
OpenDataAlex
  • 1,375
  • 5
  • 19
  • 39
0
votes
0 answers

Cannot connect React to Graphene using GraphQL

So create graphene query and works on GraphiQL, I'm trying to connect it to react using apollo client but I keep getting error. On Django the error is graphql.error.located_error.GraphQLLocatedError: 'AnonymousUser' object is not iterable on React…
0
votes
1 answer

Django graphene, filtering by object

Now my filter looks like this class Document(graphene.ObjectType): number = graphene.relay.ConnectionField( ReportDocumentNumberConnection, doc__number__in=graphene.List(graphene.String, required=False), …
Headmaster
  • 2,008
  • 4
  • 24
  • 51
0
votes
1 answer

Get file extension from undefined file python

Hello every body I need to get the one file extension form binary that's not have name and not extension but can be a ("word", "pdf", "xls"), because the api graphql can receive a list of file but the uploader of api not pas the file name oly the…
alejandro correa
  • 157
  • 2
  • 12
0
votes
0 answers

How to return a custom error message from graphene?

I created the following class to update the post in specific conditions but if the conditions == false, then I need to return { "message": "Only the owner of the post and the admin (website's wonr) can edit and delete this post "} But the…
Ali Husham
  • 816
  • 10
  • 31
0
votes
0 answers

How to set up Varnish caching for GraphQL in Django

Here is my django-benchmark project in which I implemented simple REST API and GraphQL endpoints. In front of my application I put Varnish for caching. Caching works well for Rest HTTP endpoints and does not work for GraphQL here is my Varnish…
Lukasz Dynowski
  • 11,169
  • 9
  • 81
  • 124
0
votes
1 answer

How to dynamically add custom class variables without a constructor in Python

How can class variables be dynamically be added to a Python class without calling its constructor? This is required when adding custom query fields in a custom Django Graphene Relay Node filter. In the example code below, the is_controller class…
Moritz
  • 2,987
  • 3
  • 21
  • 34
0
votes
1 answer

getting 'name' is an invalid keyword argument (using graphene-django)

i am using graphene and getting 'name' is an invalid keyword argument for GuestMutation error what is it related to? //models.py class Guest(models.Model): name = models.CharField(max_length=100) phone = models.IntegerField() def…