aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pygments_api/views.py
diff options
context:
space:
mode:
authorTom Christie2012-02-21 06:09:30 -0800
committerTom Christie2012-02-21 06:09:30 -0800
commit49ebaf106d4c4357f51f6b2bbe533512340ea113 (patch)
treeddb6cb637899a327253bffc2888e376eeab4e9f1 /examples/pygments_api/views.py
parent5a5f24f263c218f4f04a6ea54bfc48a2794e152b (diff)
parentf17f3886f42c2068e6e8a41c6e5fe6bfe1408add (diff)
downloaddjango-rest-framework-49ebaf106d4c4357f51f6b2bbe533512340ea113.tar.bz2
Merge pull request #175 from izquierdo/custom_reverse
Custom reverse() and drop set_script_prefix
Diffstat (limited to 'examples/pygments_api/views.py')
-rw-r--r--examples/pygments_api/views.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/pygments_api/views.py b/examples/pygments_api/views.py
index ffea60ae..01710bd5 100644
--- a/examples/pygments_api/views.py
+++ b/examples/pygments_api/views.py
@@ -1,10 +1,10 @@
from __future__ import with_statement # for python 2.5
from django.conf import settings
-from django.core.urlresolvers import reverse
from djangorestframework.resources import FormResource
from djangorestframework.response import Response
from djangorestframework.renderers import BaseRenderer
+from djangorestframework.utils import reverse
from djangorestframework.views import View
from djangorestframework import status
@@ -61,7 +61,7 @@ class PygmentsRoot(View):
Return a list of all currently existing snippets.
"""
unique_ids = [os.path.split(f)[1] for f in list_dir_sorted_by_ctime(HIGHLIGHTED_CODE_DIR)]
- return [reverse('pygments-instance', args=[unique_id]) for unique_id in unique_ids]
+ return [reverse('pygments-instance', request, args=[unique_id]) for unique_id in unique_ids]
def post(self, request):
"""
@@ -81,7 +81,7 @@ class PygmentsRoot(View):
remove_oldest_files(HIGHLIGHTED_CODE_DIR, MAX_FILES)
- return Response(status.HTTP_201_CREATED, headers={'Location': reverse('pygments-instance', args=[unique_id])})
+ return Response(status.HTTP_201_CREATED, headers={'Location': reverse('pygments-instance', request, args=[unique_id])})
class PygmentsInstance(View):