diff options
| author | Tom Christie | 2013-12-14 20:44:09 +0000 | 
|---|---|---|
| committer | Tom Christie | 2013-12-14 20:44:09 +0000 | 
| commit | 480b64d3138f4b37dc1cbce7202573fb1f94f2a6 (patch) | |
| tree | 96824a5b88528bea79c14bd8d928943b581fa726 /tutorial | |
| parent | f41354006f6786de5a85458c587980473cfd1b9c (diff) | |
| download | django-rest-framework-480b64d3138f4b37dc1cbce7202573fb1f94f2a6.tar.bz2 | |
Latest docs build
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 | 
