diff options
Diffstat (limited to 'examples/resourceexample/views.py')
| -rw-r--r-- | examples/resourceexample/views.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/resourceexample/views.py b/examples/resourceexample/views.py index 41d2e5c5..911fd467 100644 --- a/examples/resourceexample/views.py +++ b/examples/resourceexample/views.py @@ -8,24 +8,22 @@ from resourceexample.forms import MyForm class ExampleResource(Resource): """A basic read-only resource that points to 3 other resources.""" - allowed_methods = anon_allowed_methods = ('GET',) - def get(self, request, auth): + def get(self, request): return {"Some other resources": [reverse('another-example-resource', kwargs={'num':num}) for num in range(3)]} class AnotherExampleResource(Resource): """A basic GET-able/POST-able resource.""" - allowed_methods = anon_allowed_methods = ('GET', 'POST') form = MyForm # Optional form validation on input (Applies in this case the POST method, but can also apply to PUT) - def get(self, request, auth, num): + def get(self, request, num): """Handle GET requests""" if int(num) > 2: return Response(status.HTTP_404_NOT_FOUND) return "GET request to AnotherExampleResource %s" % num - def post(self, request, auth, content, num): + def post(self, request, num): """Handle POST requests""" if int(num) > 2: return Response(status.HTTP_404_NOT_FOUND) - return "POST request to AnotherExampleResource %s, with content: %s" % (num, repr(content)) + return "POST request to AnotherExampleResource %s, with content: %s" % (num, repr(self.CONTENT)) |
