use django.shortcuts.render
This commit is contained in:
parent
d3fc9e7eee
commit
aaa71976a6
1 changed files with 4 additions and 5 deletions
|
@ -3,8 +3,7 @@ from __future__ import division, absolute_import
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render
|
||||||
from django.template import RequestContext
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from ..shortcuts import render_to_json_response, json_response, HttpErrorJson
|
from ..shortcuts import render_to_json_response, json_response, HttpErrorJson
|
||||||
|
@ -25,12 +24,12 @@ def api(request):
|
||||||
for f in sorted(methods):
|
for f in sorted(methods):
|
||||||
api.append({'name': f,
|
api.append({'name': f,
|
||||||
'doc': actions.doc(f).replace('\n', '<br>\n')})
|
'doc': actions.doc(f).replace('\n', '<br>\n')})
|
||||||
context = RequestContext(request, {
|
context = {
|
||||||
'api': api,
|
'api': api,
|
||||||
'settings': settings,
|
'settings': settings,
|
||||||
'sitename': settings.SITENAME
|
'sitename': settings.SITENAME
|
||||||
})
|
}
|
||||||
response = render_to_response('api.html', context)
|
response = render(request, 'api.html', context)
|
||||||
response['Access-Control-Allow-Origin'] = '*'
|
response['Access-Control-Allow-Origin'] = '*'
|
||||||
return response
|
return response
|
||||||
if request.META.get('CONTENT_TYPE') == 'application/json':
|
if request.META.get('CONTENT_TYPE') == 'application/json':
|
||||||
|
|
Loading…
Reference in a new issue