diff --git a/docs/views.rst b/docs/views.rst index 441620a6..a48d81f2 100644 --- a/docs/views.rst +++ b/docs/views.rst @@ -210,7 +210,8 @@ and explicitly mentioning the methods for each:: user_view = UserAPI.as_view('user_api') app.add_url_rule('/users/', defaults={'user_id': None}, - view_func=user_view, methods=['GET', 'POST']) + view_func=user_view, methods=['GET',]) + app.add_url_rule('/users/', view_func=user_view, methods=['POST',]) app.add_url_rule('/users/', view_func=user_view, methods=['GET', 'PUT', 'DELETE']) @@ -220,8 +221,9 @@ registration code:: 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', 'POST']) - app.add_url_rule('%s<%s:%s>' % (url, pk), view_func=view_func, + 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, pk_type), view_func=view_func, methods=['GET', 'PUT', 'DELETE']) register_api(UserAPI, 'user_api', '/users/', pk='user_id')