aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/routers.md
diff options
context:
space:
mode:
authorTom Christie2013-04-26 14:59:21 +0100
committerTom Christie2013-04-26 14:59:21 +0100
commit8fa79a7fd38dda015afa658084361c6da2856e46 (patch)
treeef8080a9d24b488402429c0bae101e3f395f1f8b /docs/api-guide/routers.md
parente301e2d974649a932ab9a7ca32199c068fa30495 (diff)
downloaddjango-rest-framework-8fa79a7fd38dda015afa658084361c6da2856e46.tar.bz2
Deal with List/Instance suffixes for viewsets
Diffstat (limited to 'docs/api-guide/routers.md')
-rw-r--r--docs/api-guide/routers.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 2fda5373..7b211bfd 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -15,15 +15,15 @@ REST framework adds support for automatic URL routing to Django, and provides yo
Here's an example of a simple URL conf, that uses `DefaultRouter`.
router = routers.SimpleRouter()
- router.register(r'users', UserViewSet, 'user')
- router.register(r'accounts', AccountViewSet, 'account')
+ router.register(r'users', UserViewSet, name='user')
+ router.register(r'accounts', AccountViewSet, name='account')
urlpatterns = router.urls
There are three arguments to the `register()` method:
* `prefix` - The URL prefix to use for this set of routes.
* `viewset` - The viewset class.
-* `basename` - The base to use for the URL names that are created.
+* `name` - The base to use for the URL names that are created.
The example above would generate the following URL patterns:
@@ -119,4 +119,4 @@ The following example will only route to the `list` and `retrieve` actions, and
If you want to provide totally custom behavior, you can override `BaseRouter` and override the `get_urls()` method. The method should insect the registered viewsets and return a list of URL patterns. The registered prefix, viewset and basename tuples may be inspected by accessing the `self.registry` attribute.
-[cite]: http://guides.rubyonrails.org/routing.html \ No newline at end of file
+[cite]: http://guides.rubyonrails.org/routing.html