add call for area

This commit is contained in:
Sanj 2012-02-19 20:01:00 +05:30
parent e92fc98ab1
commit 89b46e1bce
2 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import apiviews
urlpatterns = patterns('',
(r'^route/(?P<slug>.*)$', apiviews.route), #FIXME: better regexp for route alias?
(r'^area/(?P<slug>.*)$', apiviews.area),
(r'^stop/(?P<slug>.*)$', apiviews.stop),
(r'^routes/$', apiviews.routes),
(r'^areas/$', apiviews.areas),

View File

@ -14,6 +14,13 @@ def route(request, slug):
}
})
def area(request, slug)
area = get_object_or_404_json(Area, slug=slug)
stops = [stop.get_geojson() for stop in Stop.objects.filter(area=area)]
return render_to_json_response({
'type': 'FeatureCollection',
'features': stops
})
def routes(request):
qset = Route.objects.all()