Browse Source

Merge pull request #345 from jimrollenhagen/master

Fix issue #338
pull/347/merge
Armin Ronacher 13 years ago
parent
commit
8ae6ced82d
  1. 8
      docs/views.rst

8
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/<int:user_id>', 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')

Loading…
Cancel
Save