def create(request): message="" if request.method == 'POST': points=[] for point in request.POST['poly'].split(','): points.append(fromstr(point)) points.append(points[0]) n = DIY_Neighborhood(poly = Polygon(points), name = request.POST['name'], quad='', wiki='') n.save() message = "This is an XHR POST request" return HttpResponse(message)
def test_create_poly(self): """ Create Neighborhood """ name = 'name' n = DIY_Neighborhood.create_from_string('name', 'POINT(-122.65205993652 45.53),POINT(-122.65205993652 45.525193481445),POINT(-122.63008728027 45.525880126953),POINT(-122.62940063477 45.55815246582)') self.failUnlessEqual(name, n.name)