django-rest-framework/examples/modelresourceexample/views.py
2011-05-04 09:21:17 +01:00

17 lines
654 B
Python

from djangorestframework.modelresource import InstanceModelResource, ListOrCreateModelResource
from modelresourceexample.models import MyModel
FIELDS = ('foo', 'bar', 'baz', 'absolute_url')
class MyModelRootResource(ListOrCreateModelResource):
"""A create/list resource for MyModel.
Available for both authenticated and anonymous access for the purposes of the sandbox."""
model = MyModel
fields = FIELDS
class MyModelResource(InstanceModelResource):
"""A read/update/delete resource for MyModel.
Available for both authenticated and anonymous access for the purposes of the sandbox."""
model = MyModel
fields = FIELDS