aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/routers.md
diff options
context:
space:
mode:
authorRudolf Olah2013-07-02 13:20:25 -0400
committerRudolf Olah2013-07-02 13:20:25 -0400
commite460180a4dd86ff74cc786aabfeeba1c31d17413 (patch)
treeba66181aaaabd7f310d1129d9c8787ce14645dd5 /docs/api-guide/routers.md
parentf5f23793e34324552f323725fa25f09b34380acc (diff)
downloaddjango-rest-framework-e460180a4dd86ff74cc786aabfeeba1c31d17413.tar.bz2
#955 updated router docs with more information on the `Route` named tuple and its parameters.
Diffstat (limited to 'docs/api-guide/routers.md')
-rw-r--r--docs/api-guide/routers.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index feff0fbf..1fb15fae 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -100,6 +100,18 @@ Implementing a custom router isn't something you'd need to do very often, but it
The simplest way to implement a custom router is to subclass one of the existing router classes. The `.routes` attribute is used to template the URL patterns that will be mapped to each viewset. The `.routes` attribute is a list of `Route` named tuples.
+The arguments to the `Route` named tuple are:
+
+* `url`: The URL to be routed. There are format arguments available, defined in `SimpleRouter.get_urls`:
+ * `prefix` - The URL prefix to use for this set of routes.
+ * `lookup` - The lookup field used to match against a single instance.
+ * `trailing_slash` - the value of `.trailing_slash`.
+* `mapping`: Mapping of HTTP method names to the object's methods
+* `name`: The name of the URL as used in `reverse` calls. There are format arguments available, defined in `SimpleRouter.get_urls`:
+ * `basename` - The base to use for the URL names that are created.
+* `initkwargs`: Any additional arguments to the view.
+ * `suffix` - reserved for identifying the viewset type, used when generating the breadcrumb links, e.g. `AccountViewSet` becomes `Account List` when `suffix='List'`.
+
## Example
The following example will only route to the `list` and `retrieve` actions, and does not use the trailing slash convention.