After much research, had to use the ST_AsGeoJSON()
function of PostGIS like this -
schools = School.objects.extra(
select={
'centroid': 'ST_AsGeoJSON("schools_school"."centroid")'
}
).values('code', 'name', 'centroid')
As a result, I get the JSON compatible data -
{
"results": [
{
"code": "12345678",
"centroid": "{\"type\":\"Point\",\"coordinates\":[75.32559653,16.906422997]}",
"name": "SCHOOL NAME"
},
// more
]
}
I'd still have to deserialize it on client side, but I guess that's doable and acceptable. At least I get JSON.