diff options
Diffstat (limited to 'tutorial')
| -rw-r--r-- | tutorial/quickstart.html | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tutorial/quickstart.html b/tutorial/quickstart.html index 0dfb8a45..842cacb1 100644 --- a/tutorial/quickstart.html +++ b/tutorial/quickstart.html @@ -283,6 +283,8 @@ class GroupViewSet(viewsets.ModelViewSet): </code></pre> <p>Rather than write multiple views we're grouping together all the common behavior into classes called <code>ViewSets</code>.</p> <p>We can easily break these down into individual views if we need to, but using viewsets keeps the view logic nicely organized as well as being very concise.</p> +<p>Notice that our viewset classes here are a little different from those in the <a href="../#example">frontpage example</a>, as they include <code>queryset</code> and <code>serializer_class</code> attributes, instead of a <code>model</code> attribute.</p> +<p>For trivial cases you can simply set a <code>model</code> attribute on the <code>ViewSet</code> class and the serializer and queryset will be automatically generated for you. Setting the <code>queryset</code> and/or <code>serializer_class</code> attributes gives you more explicit control of the API behaviour, and is the recommended style for most applications.</p> <h2 id="urls">URLs</h2> <p>Okay, now let's wire up the API URLs. On to <code>tutorial/urls.py</code>...</p> <pre class="prettyprint lang-py"><code>from django.conf.urls import patterns, url, include |
