diff options
| author | Tom Christie | 2011-04-27 18:07:28 +0100 |
|---|---|---|
| committer | Tom Christie | 2011-04-27 18:07:28 +0100 |
| commit | 028851bfa1ee44b8e92808b18d32278d4a473cc8 (patch) | |
| tree | 7a9497fef627d83bbc75dbd21294ff813216c828 /examples/resourceexample/views.py | |
| parent | 762a52edde09297e87c640797219c9bb8255d50a (diff) | |
| download | django-rest-framework-028851bfa1ee44b8e92808b18d32278d4a473cc8.tar.bz2 | |
Fix up tests and examples after refactoring
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)) |
