【发布时间】:2014-10-23 04:54:28
【问题描述】:
这是我的看法:
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。
那么,如何序列化外键呢?
【问题讨论】: