diff options
| author | Tom Christie | 2012-08-29 19:54:38 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-08-29 19:54:38 +0100 |
| commit | eea2aa04378d27d79e7aba12ce95c697148bd57e (patch) | |
| tree | 4ae3c67246c45df2b90e32376a067107fda486b2 /examples/resourceexample/views.py | |
| parent | ecd3733c5e229505baca5a870963f2dd492d6dd7 (diff) | |
| download | django-rest-framework-eea2aa04378d27d79e7aba12ce95c697148bd57e.tar.bz2 | |
Remove examples (to be moved to a seperate project)
Diffstat (limited to 'examples/resourceexample/views.py')
| -rw-r--r-- | examples/resourceexample/views.py | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/examples/resourceexample/views.py b/examples/resourceexample/views.py deleted file mode 100644 index 41a3111c..00000000 --- a/examples/resourceexample/views.py +++ /dev/null @@ -1,49 +0,0 @@ -from djangorestframework.reverse import reverse -from djangorestframework.views import View -from djangorestframework.response import Response -from djangorestframework import status - -from resourceexample.forms import MyForm - - -class ExampleView(View): - """ - A basic read-only view that points to 3 other views. - """ - - def get(self, request): - """ - Handle GET requests, returning a list of URLs pointing to - three other views. - """ - resource_urls = [reverse('another-example', - kwargs={'num': num}, - request=request) - for num in range(3)] - return Response({"Some other resources": resource_urls}) - - -class AnotherExampleView(View): - """ - A basic view, that can handle GET and POST requests. - Applies some simple form validation on POST requests. - """ - form = MyForm - - def get(self, request, num): - """ - Handle GET requests. - Returns a simple string indicating which view the GET request was for. - """ - if int(num) > 2: - return Response(status=status.HTTP_404_NOT_FOUND) - return Response("GET request to AnotherExampleResource %s" % num) - - def post(self, request, num): - """ - Handle POST requests, with form validation. - Returns a simple string indicating what content was supplied. - """ - if int(num) > 2: - return Response(status=status.HTTP_404_NOT_FOUND) - return Response("POST request to AnotherExampleResource %s, with content: %s" % (num, repr(self.CONTENT))) |
