Open shalakhin opened 6 years ago
Hi @shalakhin, I will check it. Thanks for report
Nevermind.
supporting other field type is:
# converter.py
from django.contrib.gis.db.models.fields import PointField
from graphene import String
from graphene_django_extras.utils import is_required
from graphene_django_extras.converter import convert_django_field
@convert_django_field.register(PointField)
def convert_pointfield_to_string(field, registry=None, input_flag=None, nested_fields=False):
return String(description=field.help_text or field.verbose_name,
required=is_required(field) and input_flag == 'create')
# types.py
from graphene_django_extras import DjangoSerializerType
from .filters import MyFilters
from .serializers import MySerializer
from .converter import *
class MyModelType(DjangoSerializerType):
class Meta:
serializer_class = MySerializer
filterset_class = MyFilters
# schema.py
import graphene
from .types import MyModelType
class MyQuery(graphene.ObjectType):
stores = MyModelType.ListField(description='List of stores.')
Any solution for this?
Exception: Don't know how to convert the Django field Store.location (<class 'django.contrib.gis.db.models.fields.PointField'>)
Any solutions for this questions..?
It seems that using https://github.com/flavors/django-graphql-geojson raises error here: