0
在我的項目中,我對用戶有3個操作,我的任務。是我怎樣才能將它們路由django在view.py中獲取數據和路由
我的代碼:
def featuresave(request):
layerId = request.POST.get("layid")
features = request.POST.get("feat")
if features == 'POINT': #(it includes Point string and coordinate as "POINT(38 39)"
als = Point()
als.layer = Layers.objects.get(id = layerId)
als.feature = features
als.save()
if feature == 'LINESTRING': #(it includes Linestring string and coordinate)
als = Line()
als.layer = Layers.objects.get(id = layerId)
als.feature = feature
als.save()
if feature == 'POLYGON': #(it includes Linestring string and coordinate)
als = Poly()
als.layer = Layers.objects.get(id = layerId)
als.feature = feature
als.save()
return HttpResponse("OK")
感謝您的幫助
您的代碼現在是否存在問題? (減去僞代碼) – 2011-02-24 13:02:27
注意你做了features = request.POST,並且在第二次和第三次測試中比較了'feature'。這是問題嗎?你不清楚。始終剪切並粘貼您的代碼,以避免在拼音中出現拼寫錯誤。 – Spacedman 2011-02-24 13:09:08
它不通過數據庫保存線模型中的線串 – aragon 2011-02-24 13:23:39