aboutsummaryrefslogtreecommitdiffstats
path: root/docs/examples/blogpost.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/blogpost.rst')
-rw-r--r--docs/examples/blogpost.rst29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/examples/blogpost.rst b/docs/examples/blogpost.rst
new file mode 100644
index 00000000..067a6bb3
--- /dev/null
+++ b/docs/examples/blogpost.rst
@@ -0,0 +1,29 @@
+ModelResource example - Blog posts
+==================================
+
+The models
+----------
+
+``models.py``
+
+.. include:: ../../examples/blogpost/models.py
+ :literal:
+
+URL configuration
+-----------------
+
+``urls.py``
+
+.. include:: ../../examples/blogpost/urls.py
+ :literal:
+
+Creating the resources
+----------------------
+
+Once we have some existing models there's very little we need to do to create the corresponding resources. We simply create a base resource and an instance resource for each model we're working with.
+django-rest-framework will provide the default operations on the resources all the usual input validation that Django's models can give us for free.
+
+``views.py``
+
+.. include:: ../../examples/blogpost/views.py
+ :literal: \ No newline at end of file