Я хочу использовать фильтр distance_Lte, как описано в readme-файле https://github.com/flavors/django-graphql-geojson.Но я не получил ожидаемый результат.Может кто-нибудь сказать мне, в чем моя неудача?
Мои классы django:
class Location(models.Model):
calendar = models.ForeignKey(Calendar, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
location = models.PointField(srid=4326, unique=True)
address = models.CharField(max_length=100)
city = models.CharField(max_length=50)
class LocationType(GeoJSONType):
class Meta:
model = Location
geojson_field = 'location'
filterset_class = LocationFilter
interfaces = (relay.Node,)
exclude = []
class LocationFilter(GeometryFilterSet):
class Meta:
model = Location
fields = {
'city': ['exact', 'icontains', 'istartswith'],
'location': ['exact', 'intersects', 'distance_lte']
}
class Query(graphene.ObjectType):
location = relay.Node.Field(LocationType)
locations = DjangoFilterConnectionField(LocationType)
Мой graphql-Запрос:
query{
locations(location_DistanceLte:{geometry:"{'type': 'Point', 'coordinates': [13.28702,52.4581]}", value:400, unit:"km"}){
edges{
node {
id
}
}
}
}
Сообщение об ошибке:
{
"errors": [
{
"message": "Argument \"location_DistanceLte\" has invalid value {geometry: \"{'type': 'Point', 'coordinates': [13.28702,52.4581]}\", value: 400, unit: \"km\"}.\nExpected type \"Geometry\", found {Geometry: \"{'type': 'Point', 'coordinates': [13.28702,52.4581]}\", value: 400, unit: \"km\"}.",
"locations": [
{
"line": 2,
"column": 34
}
]
}
]
}
Не знаюНе знаю, что я делаю не так ... Было бы неплохо, если бы вы могли помочь.
Спасибо