Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Django 4.1.5 supported? #91

Open
dharani7998 opened this issue Jan 26, 2023 · 1 comment
Open

Is Django 4.1.5 supported? #91

dharani7998 opened this issue Jan 26, 2023 · 1 comment

Comments

@dharani7998
Copy link

Hi, I was trying out the query optimizer for my POC but even a simple query returned an error.

class ProductType(DjangoObjectType):
    class Meta:
        model = Product
        fields = ALL_FIELDS


class Query(graphene.ObjectType):
    products = graphene.List(ProductType)

    def resolve_products(root, info):
        return gql_optimizer.query(Product.objects.all(), info)
{
  "errors": [
    {
      "message": "There is no current event loop in thread 'Thread-1 (process_request_thread)'.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "products"
      ]
    }
  ],
  "data": {
    "products": null
  }
}

And can you also please add an example of how to use it with the relay interface? When I tried it, it returned an error.

class ProductNode(DjangoObjectType):
    class Meta:
        model = Product
        filter_fields = "__all__"
        interfaces = (relay.Node,)


class Query(graphene.ObjectType):
    products = DjangoFilterConnectionField(ProductNode)

    def resolve_products(root, info):
        return gql_optimizer.query(Product.objects.all(), info)


{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field BrandNodeConnection.edges.",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "brands",
        "edges"
      ]
    }
  ],
  "data": {
    "brands": null
  }
}

python==3.10.8

Django==4.1.5
graphene==3.2.1
graphene-django==3.0.0
graphene-django-optimizer==0.9.1

@gdvalderrama
Copy link

Going from Django 3.2 to 4.2 this dependency breaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants