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 | |
| parent | e301e2d974649a932ab9a7ca32199c068fa30495 (diff) | |
| download | django-rest-framework-8fa79a7fd38dda015afa658084361c6da2856e46.tar.bz2 | |
Deal with List/Instance suffixes for viewsets
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-guide/routers.md | 8 | ||||
| -rw-r--r-- | docs/api-guide/viewsets.md | 2 | ||||
| -rw-r--r-- | docs/tutorial/6-viewsets-and-routers.md | 6 | 
3 files changed, 8 insertions, 8 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: diff --git a/docs/tutorial/6-viewsets-and-routers.md b/docs/tutorial/6-viewsets-and-routers.md index 876d89ac..25a974a1 100644 --- a/docs/tutorial/6-viewsets-and-routers.md +++ b/docs/tutorial/6-viewsets-and-routers.md @@ -105,8 +105,8 @@ Here's our re-wired `urls.py` file.      # Create a router and register our viewsets with it.      router = DefaultRouter() -    router.register(r'snippets', views.SnippetViewSet, 'snippet') -    router.register(r'users', views.UserViewSet, 'user') +    router.register(r'snippets', views.SnippetViewSet, name='snippet') +    router.register(r'users', views.UserViewSet, name='user')      # The API URLs are now determined automatically by the router.      # Additionally, we include the login URLs for the browseable API. @@ -148,4 +148,4 @@ We've reached the end of our tutorial.  If you want to get more involved in the  [sandbox]: http://restframework.herokuapp.com/  [github]: https://github.com/tomchristie/django-rest-framework  [group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework -[twitter]: https://twitter.com/_tomchristie
\ No newline at end of file +[twitter]: https://twitter.com/_tomchristie | 
