mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 05:20:12 +03:00
Resolve merge conflict
This commit is contained in:
parent
e946a496dc
commit
3bb1556820
|
@ -252,6 +252,14 @@ class SimpleRouter(BaseRouter):
|
||||||
lookup=lookup,
|
lookup=lookup,
|
||||||
trailing_slash=self.trailing_slash
|
trailing_slash=self.trailing_slash
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# If there is no prefix, the first part of the url is probably
|
||||||
|
# controlled by project's urls.py and the router is in an app,
|
||||||
|
# so a slash in the beginning will (A) cause Django to give
|
||||||
|
# warnings and (B) generate URLS that will require using '//'.
|
||||||
|
if not prefix and regex[:2] == '^/':
|
||||||
|
regex = '^' + regex[2:]
|
||||||
|
|
||||||
view = viewset.as_view(mapping, **route.initkwargs)
|
view = viewset.as_view(mapping, **route.initkwargs)
|
||||||
name = route.name.format(basename=basename)
|
name = route.name.format(basename=basename)
|
||||||
ret.append(url(regex, view, name=name))
|
ret.append(url(regex, view, name=name))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user