mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Add notes on lookup_prefix argument and why it's there even though unused by the default implementations.
This commit is contained in:
parent
fbaba0a309
commit
193af483ef
|
@ -188,6 +188,12 @@ class SimpleRouter(BaseRouter):
|
||||||
"""
|
"""
|
||||||
Given a viewset, return the portion of URL regex that is used
|
Given a viewset, return the portion of URL regex that is used
|
||||||
to match against a single instance.
|
to match against a single instance.
|
||||||
|
|
||||||
|
Note that lookup_prefix is not used directly inside REST rest_framework
|
||||||
|
itself, but is required in order to nicely support nested router
|
||||||
|
implementations, such as drf-nested-routers.
|
||||||
|
|
||||||
|
https://github.com/alanjds/drf-nested-routers
|
||||||
"""
|
"""
|
||||||
if self.trailing_slash:
|
if self.trailing_slash:
|
||||||
base_regex = '(?P<{lookup_prefix}{lookup_field}>[^/]+)'
|
base_regex = '(?P<{lookup_prefix}{lookup_field}>[^/]+)'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user