diff options
| author | Tom Christie | 2013-12-13 16:32:34 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-12-13 16:32:34 +0000 |
| commit | 9c41c007afc71c899306bcb02e40bdfc36b09146 (patch) | |
| tree | ca0da04aed0c1b96ddf14a801dc54b5a72a72461 /docs/tutorial/quickstart.md | |
| parent | ed931b90ae9e72f963673e6e188b1802a5a65360 (diff) | |
| parent | ca244ad614e2f6fb4fef1dc9987be996d2624303 (diff) | |
| download | django-rest-framework-9c41c007afc71c899306bcb02e40bdfc36b09146.tar.bz2 | |
Merge branch 'master' into 2.4.0
Conflicts:
.travis.yml
docs/api-guide/routers.md
docs/topics/release-notes.md
rest_framework/compat.py
Diffstat (limited to 'docs/tutorial/quickstart.md')
| -rw-r--r-- | docs/tutorial/quickstart.md | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index 06eec3c4..8bf8c7f5 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -85,10 +85,14 @@ Right, we'd better write some views then. Open `quickstart/views.py` and get ty queryset = Group.objects.all() serializer_class = GroupSerializer -Rather that write multiple views we're grouping together all the common behavior into classes called `ViewSets`. +Rather than write multiple views we're grouping together all the common behavior into classes called `ViewSets`. 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. +Notice that our viewset classes here are a little different from those in the [frontpage example][readme-example-api], as they include `queryset` and `serializer_class` attributes, instead of a `model` attribute. + +For trivial cases you can simply set a `model` attribute on the `ViewSet` class and the serializer and queryset will be automatically generated for you. Setting the `queryset` and/or `serializer_class` attributes gives you more explicit control of the API behaviour, and is the recommended style for most applications. + ## URLs Okay, now let's wire up the API URLs. On to `tutorial/urls.py`... @@ -169,6 +173,7 @@ Great, that was easy! If you want to get a more in depth understanding of how REST framework fits together head on over to [the tutorial][tutorial], or start browsing the [API guide][guide]. +[readme-example-api]: ../#example [image]: ../img/quickstart.png [tutorial]: 1-serialization.md [guide]: ../#api-guide |
