diff options
| author | tom christie tom@tomchristie.com | 2011-02-01 22:37:51 +0000 |
|---|---|---|
| committer | tom christie tom@tomchristie.com | 2011-02-01 22:37:51 +0000 |
| commit | 6ce5b643fbeab322d85dbaed87d11ffb950c5bed (patch) | |
| tree | e08ad4cc8f465390564a3003daf8cf04b708438b /examples/modelresourceexample/views.py | |
| parent | 196c21f37632e213702995651fd739426b6ee13a (diff) | |
| download | django-rest-framework-6ce5b643fbeab322d85dbaed87d11ffb950c5bed.tar.bz2 | |
Added resourceexample, moved simpleexample to modelresourceexample
Diffstat (limited to 'examples/modelresourceexample/views.py')
| -rw-r--r-- | examples/modelresourceexample/views.py | 18 |
1 files changed, 18 insertions, 0 deletions
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 |
