aboutsummaryrefslogtreecommitdiffstats
path: root/docs/howto/mixin.rst
diff options
context:
space:
mode:
authortom christie tom@tomchristie.com2011-02-19 13:12:35 +0000
committertom christie tom@tomchristie.com2011-02-19 13:12:35 +0000
commite4fff6ea6e5422af23c324897ed1cff8f8a6e903 (patch)
tree030c0d0a02e25ffdef43781fbc815dbce48dd16d /docs/howto/mixin.rst
parent57b3a372f2122d022f9d6f43818e5fe9d318ce03 (diff)
downloaddjango-rest-framework-e4fff6ea6e5422af23c324897ed1cff8f8a6e903.tar.bz2
Clean up the docs
Diffstat (limited to 'docs/howto/mixin.rst')
-rw-r--r--docs/howto/mixin.rst30
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/howto/mixin.rst b/docs/howto/mixin.rst
new file mode 100644
index 00000000..68a73690
--- /dev/null
+++ b/docs/howto/mixin.rst
@@ -0,0 +1,30 @@
+Using Django REST framework Mixin classes
+=========================================
+
+This example demonstrates creating a REST API **without** using Django REST framework's :class:`.Resource` or :class:`.ModelResource`,
+but instead using Django :class:`View` class, and adding the :class:`EmitterMixin` class to provide full HTTP Accept header content negotiation,
+a browseable Web API, and much of the other goodness that Django REST framework gives you for free.
+
+.. note::
+
+ A live sandbox instance of this API is available for testing:
+
+ * http://api.django-rest-framework.org/mixin/
+
+ You can browse the API using a web browser, or from the command line::
+
+ curl -X GET http://api.django-rest-framework.org/mixin/
+
+
+URL configuration
+-----------------
+
+Everything we need for this example can go straight into the URL conf...
+
+``urls.py``
+
+.. include:: ../../examples/mixin/urls.py
+ :literal:
+
+That's it. Auto-magically our API now supports multiple output formats, specified either by using standard HTTP Accept header content negotiation, or by using the `&_accept=application/json` style parameter overrides.
+We even get a nice HTML view which can be used to self-document our API.