コード例 #1
0
ファイル: views.py プロジェクト: eknuth/pimh
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)        
コード例 #2
0
ファイル: tests.py プロジェクト: eknuth/pimh
 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)