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

This commit is contained in:
Tom Christie 2013-12-13 20:22:56 +00:00
parent fbaba0a309
commit 193af483ef

View File

@ -188,6 +188,12 @@ class SimpleRouter(BaseRouter):
"""
Given a viewset, return the portion of URL regex that is used
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:
base_regex = '(?P<{lookup_prefix}{lookup_field}>[^/]+)'