Skip to content

Commit 8ae6ced

Browse files
committed
Merge pull request pallets#345 from jimrollenhagen/master
Fix issue pallets#338
2 parents d628df6 + e345a3a commit 8ae6ced

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/views.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ and explicitly mentioning the methods for each::
210210

211211
user_view = UserAPI.as_view('user_api')
212212
app.add_url_rule('/users/', defaults={'user_id': None},
213-
view_func=user_view, methods=['GET', 'POST'])
213+
view_func=user_view, methods=['GET',])
214+
app.add_url_rule('/users/', view_func=user_view, methods=['POST',])
214215
app.add_url_rule('/users/<int:user_id>', view_func=user_view,
215216
methods=['GET', 'PUT', 'DELETE'])
216217

@@ -220,8 +221,9 @@ registration code::
220221
def register_api(view, endpoint, url, pk='id', pk_type='int'):
221222
view_func = view.as_view(endpoint)
222223
app.add_url_rule(url, defaults={pk: None},
223-
view_func=view_func, methods=['GET', 'POST'])
224-
app.add_url_rule('%s<%s:%s>' % (url, pk), view_func=view_func,
224+
view_func=view_func, methods=['GET',])
225+
app.add_url_rule(url, view_func=view_func, methods=['POST',])
226+
app.add_url_rule('%s<%s:%s>' % (url, pk, pk_type), view_func=view_func,
225227
methods=['GET', 'PUT', 'DELETE'])
226228

227229
register_api(UserAPI, 'user_api', '/users/', pk='user_id')

0 commit comments

Comments
 (0)