From 6ce5b643fbeab322d85dbaed87d11ffb950c5bed Mon Sep 17 00:00:00 2001 From: tom christie tom@tomchristie.com Date: Tue, 1 Feb 2011 22:37:51 +0000 Subject: Added resourceexample, moved simpleexample to modelresourceexample --- examples/modelresourceexample/views.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/modelresourceexample/views.py (limited to 'examples/modelresourceexample/views.py') diff --git a/examples/modelresourceexample/views.py b/examples/modelresourceexample/views.py new file mode 100644 index 00000000..e912c019 --- /dev/null +++ b/examples/modelresourceexample/views.py @@ -0,0 +1,18 @@ +from djangorestframework.modelresource import ModelResource, RootModelResource +from modelresourceexample.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 -- cgit v1.2.3