get / edit stop

This commit is contained in:
Sanj 2012-02-19 18:27:08 +05:30
parent ebdb732921
commit be8376c8fa
2 changed files with 10 additions and 4 deletions

View File

@ -3,4 +3,5 @@ import apiviews
urlpatterns = patterns('',
(r'^route/(?P<alias>.*)$', apiviews.route), #FIXME: better regexp for route alias?
(r'^stop/(?P<id>[0-9]*)$', apiviews.stop),
)

View File

@ -14,9 +14,14 @@ def route(request, alias):
}
})
@login_required(request, id):
if not id:
stop = Stop() #FIXME: should this return an error instead?
def stop:(request, id):
if request.POST:
if not id:
stop = Stop() #FIXME: should this return an error instead?
else:
stop = get_object_or_404_json(Stop, id=id)
return stop.from_geojson(request.POST)
else:
stop = get_object_or_404_json(Stop, id=id)
return stop.from_geojson(request.POST)
return stop.get_geojson()