예제 #1
0
파일: routes.py 프로젝트: ssargent/cooking
def register_api(view, endpoint,  url, pk='id', pk_type='int'):
    view_func = view.as_view(endpoint)
    app.add_url_rule(url, defaults={pk: None},
                     view_func=view_func, methods=['GET',])
    app.add_url_rule(url, view_func=view_func, methods=['POST',])
    app.add_url_rule('%s<%s:%s>' % (url, pk_type, pk), view_func=view_func,
                     methods=['GET', 'PUT', 'DELETE'])
예제 #2
0
파일: routes.py 프로젝트: ssargent/cooking
def url(url_rule, import_name, **options):
	view = LazyView('mythicalfood.' + import_name)
	app.add_url_rule(url_rule, view_func=view,**options)