Browse Source

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/
pull/1/head
Hidden Z 11 years ago
parent
commit
34d3243fcc
  1. 7
      pyi2phosts/jump/views.py
  2. 4
      pyi2phosts/postkey/views.py

7
pyi2phosts/jump/views.py

@ -4,6 +4,7 @@ from django.shortcuts import render_to_response @@ -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): @@ -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): @@ -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('/')

4
pyi2phosts/postkey/views.py

@ -106,7 +106,7 @@ def success(request): @@ -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): @@ -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…
Cancel
Save