1
여기에 내 생각이다 :<장고 개체>는 : JSON 직렬화 할 수없는
def display_maps(request):
#query_agao = ButuanMaps.objects.filter(clandpin=search_term)
#x = Owner.objects.select_related('landproperty_butuanmaps').get(id=5)
query_agao = ButuanMaps.objects.all().select_related('landproperty')[:10]
query_all = ButuanMaps.objects.all()[:10]
djf = Django.Django(geodjango='geom', properties=['id','clandpin','ssectionid'])
geoj = GeoJSON.GeoJSON()
butuan_agao = geoj.encode(djf.decode(query_agao.transform(3857)))
return render(request, "index.html", {
'butuan_agao': butuan_agao,
'query_agao': query_agao,
'query_all': query_all})
id
및 clandpin
이 외래 키가 아니라 ssectionid
가.
그래서 외래 키를 직렬화하는 방법은 무엇입니까?
감사! 나는 그것을 시도했지만 에러를 반환했다. 'str'객체에 'transform'속성이 없다. –
query_agao가 쿼리 개체 (단일 모델 개체가 아님)인지 확인할 수있다. 게시 할 수 있다면 도움이 될 것이다. 스택 추적 – Shivansh