Commit 193af483 by Tom Christie

Add notes on lookup_prefix argument and why it's there even though unused by the…

Add notes on lookup_prefix argument and why it's there even though unused by the default implementations.
parent fbaba0a3
...@@ -188,6 +188,12 @@ class SimpleRouter(BaseRouter): ...@@ -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}>[^/]+)'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment