aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/viewsets.md
diff options
context:
space:
mode:
authorTom Christie2013-04-25 12:47:34 +0100
committerTom Christie2013-04-25 12:47:34 +0100
commit95abe6e8445f59f9e52609b0c54d9276830dbfd3 (patch)
treeb74d076e5d4e84d0ed8ead11843ad5e52b9da335 /docs/api-guide/viewsets.md
parentb94da2468cdda6b0ad491574d35097d0e336ea7f (diff)
downloaddjango-rest-framework-95abe6e8445f59f9e52609b0c54d9276830dbfd3.tar.bz2
Cleanup docstrings
Diffstat (limited to 'docs/api-guide/viewsets.md')
-rw-r--r--docs/api-guide/viewsets.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md
index 5aa66196..2f0f112b 100644
--- a/docs/api-guide/viewsets.md
+++ b/docs/api-guide/viewsets.md
@@ -41,6 +41,10 @@ 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')
+ urlpatterns = router.urls
+
There are two main advantages of using a `ViewSet` class over using a `View` class.
* Repeated logic can be combined into a single class. In the above example, we only need to specify the `queryset` once, and it'll be used across multiple views.