From af9e4f69d732cc643d6ec7ae13d4a19ac0332d44 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 21 Feb 2012 20:12:14 +0000 Subject: Merging master into develop --- examples/resourceexample/views.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'examples/resourceexample') diff --git a/examples/resourceexample/views.py b/examples/resourceexample/views.py index 44c4176a..f2a7a08a 100644 --- a/examples/resourceexample/views.py +++ b/examples/resourceexample/views.py @@ -1,5 +1,4 @@ -from django.core.urlresolvers import reverse - +from djangorestframework.utils import reverse from djangorestframework.views import View from djangorestframework.response import Response from djangorestframework import status @@ -14,9 +13,12 @@ class ExampleView(View): def get(self, request): """ - Handle GET requests, returning a list of URLs pointing to 3 other views. + Handle GET requests, returning a list of URLs pointing to + three other views. """ - return Response({"Some other resources": [reverse('another-example', kwargs={'num':num}) for num in range(3)]}) + urls = [reverse('another-example', request, kwargs={'num': num}) + for num in range(3)] + return Response({"Some other resources": urls}) class AnotherExampleView(View): @@ -32,7 +34,7 @@ class AnotherExampleView(View): Returns a simple string indicating which view the GET request was for. """ if int(num) > 2: - return Response(status.HTTP_404_NOT_FOUND) + return Response(status=status.HTTP_404_NOT_FOUND) return Response("GET request to AnotherExampleResource %s" % num) def post(self, request, num): @@ -41,5 +43,5 @@ class AnotherExampleView(View): Returns a simple string indicating what content was supplied. """ if int(num) > 2: - return Response(status.HTTP_404_NOT_FOUND) + return Response(status=status.HTTP_404_NOT_FOUND) return Response("POST request to AnotherExampleResource %s, with content: %s" % (num, repr(self.CONTENT))) -- cgit v1.2.3 From 5fd4c639d7c64572dd07dc31dcd627bed9469b05 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 21 Feb 2012 20:57:36 +0000 Subject: Merge master into develop --- examples/resourceexample/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/resourceexample') diff --git a/examples/resourceexample/views.py b/examples/resourceexample/views.py index f2a7a08a..8e7be302 100644 --- a/examples/resourceexample/views.py +++ b/examples/resourceexample/views.py @@ -1,4 +1,4 @@ -from djangorestframework.utils import reverse +from djangorestframework.reverse import reverse from djangorestframework.views import View from djangorestframework.response import Response from djangorestframework import status -- cgit v1.2.3