I'm doing an autocomplete input.
I'm trying to create a json response. In my model I have this:
position = GeopositionField(default=DEFAULT)
When I try to create the json response gives me this error:
TypeError: Geoposition(40,2) is not JSON serializable
How could I fix this ?
Edit 1:
In views.py
:
data =[{'label': n.nombre, 'nombre': n.nombre, 'posicion': n.position, 'status': n.estado} for n in
Dispositivo.objects.filter(nombre__icontains=what)]
return HttpResponse(json.dumps(data), mimetype='application/json')