Open KianChavoshiNejad opened 7 months ago
Also running into a use case for this in a project I'm working on
I don't know what I'm doing, but the following code worked for me
from django.contrib.gis.db import models
from graphene_django.converter import convert_django_field
@convert_django_field.register(models.GeneratedField)
def convert_generated_field(field, registry=None):
convert_django_field.dispatch(field.output_field.__class__)
Note: for support questions, please use stackoverflow. This repository's issues are reserved for feature requests and bug reports.
I used Django 5's GenerativeField to define one of my fields
When I try to pass the value through the
DjangoObjectType
, I received the following error:Exception: Don't know how to convert the Django field ModelName.total_price (<class 'django.db.models.fields.generated.GeneratedField'>)
GeneratedField
DjangoObjectType
for the model created in step 1What is the expected behavior? The expected behavior is for
DjangoObjectType
to use theoutput_field
type defined in the GeneratedField.What is the motivation / use case for changing the behavior? We would like to leverage the new
GeneratedField
functionality in Django 5.Please tell us about your environment:
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)