def test_filter_points(self): point1 = Point(**point_data_1) point1.save() point2 = Point(**point_data_2) point2.save() assert [x for x in filter_points(100, 0, 100, 0)] == [point1] assert [x for x in filter_points(0, -20, 50, 0)] == [point2]
def read(self, request): """ Return all points the inside the bbox, by default 50 """ points = filter_points(**request.form.cleaned_data) point_ids = [point.id for point in points.all()[:50]] return Wifi.objects.filter(geo__in=point_ids).all()