aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/views.md
diff options
context:
space:
mode:
authorTom Christie2012-09-01 20:26:27 +0100
committerTom Christie2012-09-01 20:26:27 +0100
commitdeedf6957d14c2808c00a009ac2c1d4528cb80c9 (patch)
treea029d40c05ceeaffa9d1fb420096c7de4878cbb5 /docs/api-guide/views.md
parent02dcdca13b7cbe89e1980bab7e8274500bf9e4e1 (diff)
downloaddjango-rest-framework-deedf6957d14c2808c00a009ac2c1d4528cb80c9.tar.bz2
REST framework 2 docs
Diffstat (limited to 'docs/api-guide/views.md')
-rw-r--r--docs/api-guide/views.md39
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/api-guide/views.md b/docs/api-guide/views.md
new file mode 100644
index 00000000..dd1dbebe
--- /dev/null
+++ b/docs/api-guide/views.md
@@ -0,0 +1,39 @@
+> Django's class based views are a welcome departure from the old-style views.
+>
+> — [Reinout van Rees][cite]
+
+# Views
+
+REST framework provides a simple `APIView` class, built on Django's `django.generics.views.View`. The `APIView` class ensures five main things:
+
+1. Any requests inside the view will become `Request` instances.
+2. `Request` instances will have their `renderers` and `authentication` attributes automatically set.
+3. `Response` instances will have their `parsers` and `serializer` attributes automatically set.
+4. `APIException` exceptions will be caught and return appropriate responses.
+5. Any permissions provided will be checked prior to passing the request to a handler method.
+
+Additionally there are a some minor extras, such as providing a default `options` handler, setting some common headers on the response prior to return, and providing the useful `initial()` and `final()` hooks.
+
+## APIView
+
+## Method handlers
+
+Describe that APIView handles regular .get(), .post(), .put(), .delete() etc...
+
+## .initial(request, *args, **kwargs)
+
+## .final(request, response, *args, **kwargs)
+
+## .parsers
+
+## .renderers
+
+## .serializer
+
+## .authentication
+
+## .permissions
+
+## .headers
+
+[cite]: http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html \ No newline at end of file