Added json views
This commit is contained in:
parent
77713d81b0
commit
377a6bacc4
2 changed files with 13 additions and 0 deletions
5
urls.py
5
urls.py
|
@ -5,3 +5,8 @@ urlpatterns = patterns('pdfformfiller.views',
|
||||||
url(r'^(?P<pdf>.*)/edit/$', editor.PDFFormFillerEditor.as_view(), name='pdfformfiller-edit'),
|
url(r'^(?P<pdf>.*)/edit/$', editor.PDFFormFillerEditor.as_view(), name='pdfformfiller-edit'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
urlpatterns += patterns('pdfformfiller.views.json',
|
||||||
|
url(r'^json/(?P<pdf>\d+)/$', 'get_pages', name='pdfformfiller-json-get-pages'),
|
||||||
|
url(r'^json/(?P<pdf>\d+)/(?P<page_no>\d+)/$', 'get_page', name='pdfformfiller-json-get-page'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
8
views/json.py
Normal file
8
views/json.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
|
def json_response(context):
|
||||||
|
response = HttpResponse(context)
|
||||||
|
response['Content-Type'] = 'application/pdf'
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue