mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Merge 94f4003ea5
into 871ce34983
This commit is contained in:
commit
a71537a1cf
|
@ -100,13 +100,13 @@ class SimpleRouter(BaseRouter):
|
||||||
# Generated using @list_route decorator
|
# Generated using @list_route decorator
|
||||||
# on methods of the viewset.
|
# on methods of the viewset.
|
||||||
DynamicListRoute(
|
DynamicListRoute(
|
||||||
url=r'^{prefix}/{methodname}{trailing_slash}$',
|
url=r'^{prefix}{methodname}{trailing_slash}$',
|
||||||
name='{basename}-{methodnamehyphen}',
|
name='{basename}-{methodnamehyphen}',
|
||||||
initkwargs={}
|
initkwargs={}
|
||||||
),
|
),
|
||||||
# Detail route.
|
# Detail route.
|
||||||
Route(
|
Route(
|
||||||
url=r'^{prefix}/{lookup}{trailing_slash}$',
|
url=r'^{prefix}{lookup}{trailing_slash}$',
|
||||||
mapping={
|
mapping={
|
||||||
'get': 'retrieve',
|
'get': 'retrieve',
|
||||||
'put': 'update',
|
'put': 'update',
|
||||||
|
@ -119,7 +119,7 @@ class SimpleRouter(BaseRouter):
|
||||||
# Dynamically generated detail routes.
|
# Dynamically generated detail routes.
|
||||||
# Generated using @detail_route decorator on methods of the viewset.
|
# Generated using @detail_route decorator on methods of the viewset.
|
||||||
DynamicDetailRoute(
|
DynamicDetailRoute(
|
||||||
url=r'^{prefix}/{lookup}/{methodname}{trailing_slash}$',
|
url=r'^{prefix}{lookup}/{methodname}{trailing_slash}$',
|
||||||
name='{basename}-{methodnamehyphen}',
|
name='{basename}-{methodnamehyphen}',
|
||||||
initkwargs={}
|
initkwargs={}
|
||||||
),
|
),
|
||||||
|
@ -255,6 +255,9 @@ class SimpleRouter(BaseRouter):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Build the url pattern
|
# Build the url pattern
|
||||||
|
if prefix:
|
||||||
|
prefix += "/"
|
||||||
|
|
||||||
regex = route.url.format(
|
regex = route.url.format(
|
||||||
prefix=prefix,
|
prefix=prefix,
|
||||||
lookup=lookup,
|
lookup=lookup,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user