mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-01-22 12:34:17 +00:00
Use RequestContext in all render_to_response()
We have {% csrf_token %} in a templates, but the context in render_to_response() does not provide the value. https://docs.djangoproject.com/en/1.5/ref/contrib/csrf/
This commit is contained in:
parent
8e2ac32684
commit
34d3243fcc
@ -4,6 +4,7 @@ from django.shortcuts import render_to_response
|
||||
from django.shortcuts import redirect
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.conf import settings
|
||||
from django.template import RequestContext
|
||||
|
||||
from pyi2phosts.postkey.models import i2phost
|
||||
from pyi2phosts.lib.validation import validate_hostname
|
||||
@ -16,13 +17,13 @@ def jumper(request, host):
|
||||
return render_to_response('jump-error.html', {
|
||||
'title': settings.SITE_NAME,
|
||||
'error': e,
|
||||
})
|
||||
}, context_instance=RequestContext(request))
|
||||
try:
|
||||
h = i2phost.objects.get(name=hostname)
|
||||
except i2phost.DoesNotExist:
|
||||
return render_to_response('jump-unknown.html', {
|
||||
'title': settings.SITE_NAME,
|
||||
})
|
||||
}, context_instance=RequestContext(request))
|
||||
if h.activated == True:
|
||||
key = h.b64hash
|
||||
else:
|
||||
@ -47,7 +48,7 @@ def jumper(request, host):
|
||||
return render_to_response('jump.html', {
|
||||
'title': settings.SITE_NAME,
|
||||
'url': url,
|
||||
})
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
def index(request):
|
||||
return redirect('/')
|
||||
|
@ -106,7 +106,7 @@ def success(request):
|
||||
return render_to_response('success_submission.html', {
|
||||
'title': settings.SITE_NAME,
|
||||
'hostname': hn,
|
||||
})
|
||||
}, context_instance=RequestContext(request))
|
||||
else:
|
||||
return redirect('/')
|
||||
|
||||
@ -136,7 +136,7 @@ def subdomain(request):
|
||||
return render_to_response('subdomain_http_verify_failure.html', {
|
||||
'title': settings.SITE_NAME,
|
||||
'code': e.code,
|
||||
})
|
||||
}, context_instance=RequestContext(request))
|
||||
else:
|
||||
log.debug('subdomain verification success, saving host')
|
||||
s = save_host(request)
|
||||
|
Loading…
x
Reference in New Issue
Block a user