aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simpleexample/views.py
diff options
context:
space:
mode:
authortom christie tom@tomchristie.com2011-01-30 18:30:39 +0000
committertom christie tom@tomchristie.com2011-01-30 18:30:39 +0000
commit42f2f9b40d1295e18a5b720b0d1f6ad85e928d8a (patch)
tree458f97992bcd1348a413d21a5925f933ba7f74e3 /examples/simpleexample/views.py
parent8a470f031eeccf45625c3e3e18a8743021b38d41 (diff)
downloaddjango-rest-framework-42f2f9b40d1295e18a5b720b0d1f6ad85e928d8a.tar.bz2
Rename to django-rest-framework, get simpleexample working
Diffstat (limited to 'examples/simpleexample/views.py')
-rw-r--r--examples/simpleexample/views.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/simpleexample/views.py b/examples/simpleexample/views.py
new file mode 100644
index 00000000..1f113ac2
--- /dev/null
+++ b/examples/simpleexample/views.py
@@ -0,0 +1,18 @@
+from djangorestframework.modelresource import ModelResource, RootModelResource
+from simpleexample.models import MyModel
+
+FIELDS = ('foo', 'bar', 'baz', 'absolute_url')
+
+class MyModelRootResource(RootModelResource):
+ """A create/list resource for MyModel.
+ Available for both authenticated and anonymous access for the purposes of the sandbox."""
+ model = MyModel
+ allowed_methods = anon_allowed_methods = ('GET', 'POST')
+ fields = FIELDS
+
+class MyModelResource(ModelResource):
+ """A read/update/delete resource for MyModel.
+ Available for both authenticated and anonymous access for the purposes of the sandbox."""
+ model = MyModel
+ allowed_methods = anon_allowed_methods = ('GET', 'PUT', 'DELETE')
+ fields = FIELDS