diff options
| author | Tom Christie | 2013-04-26 14:59:21 +0100 |
|---|---|---|
| committer | Tom Christie | 2013-04-26 14:59:21 +0100 |
| commit | 8fa79a7fd38dda015afa658084361c6da2856e46 (patch) | |
| tree | ef8080a9d24b488402429c0bae101e3f395f1f8b /docs/api-guide | |
| parent | e301e2d974649a932ab9a7ca32199c068fa30495 (diff) | |
| download | django-rest-framework-8fa79a7fd38dda015afa658084361c6da2856e46.tar.bz2 | |
Deal with List/Instance suffixes for viewsets
Diffstat (limited to 'docs/api-guide')
| -rw-r--r-- | docs/api-guide/routers.md | 8 | ||||
| -rw-r--r-- | docs/api-guide/viewsets.md | 2 |
2 files changed, 5 insertions, 5 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 diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index 36a4dbd5..8af35bb8 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -42,7 +42,7 @@ If we need to, we can bind this viewset into two seperate views, like so: Typically we wouldn't do this, but would instead register the viewset with a router, and allow the urlconf to be automatically generated. router = DefaultRouter() - router.register(r'users', UserViewSet, 'user') + router.register(r'users', UserViewSet, name='user') urlpatterns = router.urls Rather than writing your own viewsets, you'll often want to use the existing base classes that provide a default set of behavior. For example: |
