Python 无法识别为WKT EWKT的字符串或unicode输入,POST时出现HEXEWKB错误
我现在正在处理一个GeoDjango项目,目前收到的字符串或unicode输入无法识别为WKT EWKT,提交表单时出现HEXEWKB错误。Python 无法识别为WKT EWKT的字符串或unicode输入,POST时出现HEXEWKB错误,python,django,forms,postgis,geodjango,Python,Django,Forms,Postgis,Geodjango,我现在正在处理一个GeoDjango项目,目前收到的字符串或unicode输入无法识别为WKT EWKT,提交表单时出现HEXEWKB错误。 表单中填充了一组图像,这些图像是通过查询称为ImagesInstagram的图像表而生成的。表单显示设定距离内的所有图像,以及每个图像旁边的单选按钮。当我选择一个图像的单选按钮时,我想获取该图像的id,并将该id发布到名为ImagesTravel的新的/单独的表中。 用于在表单中生成图像的查询工作正常,当我选择一个单选按钮并单击提交表单时,变量也会填充正确
表单中填充了一组图像,这些图像是通过查询称为ImagesInstagram的图像表而生成的。表单显示设定距离内的所有图像,以及每个图像旁边的单选按钮。当我选择一个图像的单选按钮时,我想获取该图像的id,并将该id发布到名为ImagesTravel的新的/单独的表中。 用于在表单中生成图像的查询工作正常,当我选择一个单选按钮并单击提交表单时,变量也会填充正确的图像id。但是,我仍然收到错误,就好像我错误地传递了一个geo_点。下面是所有的代码 意见 视图来填充表单 查看表单是否将帖子提交到 模板
{%csrf_令牌%}
{place in places%%中的位置为%s}
{%endfor%}
我知道在我的代码中可能有几件事情需要更正,比如验证表单中的数据等等。。。但是代码块curate\u detailed\u main\u auth甚至没有运行,因为错误发生在它尝试执行该代码块之前。我是django的新手,我一直在尽可能多地阅读,这篇文章是最后的选择,因为我自己还没有弄明白这一点。谢谢,我可以发布你可能需要的任何其他相关信息,请告诉我
谢谢
def curate_detailed_main(request, geo_point):
placestring = str(geo_point)
pnt = GEOSGeometry(placestring)
places = ImagesInstagram.objects.filter(geo_point__distance_lte=(pnt, D(km=5)))
args = {}
args.update(csrf(request))
args['places'] = places
return render_to_response('curate_detailed_main.html', args)
def curate_detailed_main_auth(request):
if request.method == 'POST':
p = get_object_or_404(ImagesInstagram, pk=instagram_id_num)
selected_image = p.choice_set.get(pk=request.POST['choice'])
ImagesTravel.Image_id = selected_image.Image_id
ImagesTravel.save()
return HttpResponseRedirect('/')
else:
return render_to_response('curate_detailed_main.html')
<form action="/curate/get/main/auth/" method="post" id="UpdateMain" name="myForm">
{% csrf_token %}
<input type="submit" value="Update" />
{% for place in places %}
<table border="0">
<tr>
<th><img name="low_res_url" src="{{ place.low_res_url}}" width="200"/></th>
<th><input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ place.geo_point }}"></th>
</tr>
</table>
{% endfor %}
</form>