在我的项目中,我有3个用户操作,我的任务。我怎么能路由他们
我的代码:
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")
感谢您的帮助
答案 0 :(得分:0)
查看您的评论,并假设您正在谈论您的request.POST.feat包括:
#( it includes Point string and coordinate as "POINT(38 39)"
#( it includes Linestring string and coordinate )
#( it includes Linestring string and coordinate )
和评论前的比较......你不会得到一场比赛......
您的比较应该类似于
if feature.find('POINT') != -1:
#do something
elif feature.find('LINESTRING') != -1:
#do something
elif feature.find('POLYGON') != -1:
#do something