add call for area
This commit is contained in:
parent
e92fc98ab1
commit
89b46e1bce
|
@ -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),
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user