我的模型:
class Mod(models.model)
name = models.CharField(max_length = 255)
co_x = models.DecimalField(max_digits = 11, decimal_places = 8)
co_y = models.DecimalField(max_digits = 11, decimal_places = 8)
我的看法:
def closedPoint(request):
location_name = str(request.POST.get("lo", default=""))
nokta_x = int(float(request.POST.get("x"))
nokta_y = int(float(request.POST.get("y"))
poi = Point(nokta_x, nokta_y, srid = 900913)
sk = Mod()
poi_s = Point(sk.co_x, co_y, srid = 900913)
resut_poi = Mod.objects.filter(poi_s__distance_lte = (poi, D(km = 7))).filter(name__in = location_name)
在这里我想扣除 7 公里内的最近点,但它给出“为点初始化提供的参数无效