For this route:

config.add_route('item_get', '/item/{id}', request_method='GET')

What is the easiest way to get the {id} part from a view that uses this route?

有帮助吗?

解决方案

A dictionary is added to the request, called request.matchdict:

id_ = request.matchdict['id']
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top