Stop instantiating context objects as it is deprecated

This commit is contained in:
Raphael Michel
2016-09-26 18:47:30 +02:00
parent a4ab544fd1
commit 00810cdfab
4 changed files with 5 additions and 11 deletions

View File

@@ -1,13 +1,12 @@
from django.http import HttpResponseForbidden
from django.middleware.csrf import REASON_NO_CSRF_COOKIE, REASON_NO_REFERER
from django.template import Context
from django.template.loader import get_template
from django.utils.translation import ugettext as _
def csrf_failure(request, reason=""):
t = get_template('csrffail.html')
c = Context({
c = {
'reason': reason,
'no_referer': reason == REASON_NO_REFERER,
'no_referer1': _(
@@ -29,5 +28,5 @@ def csrf_failure(request, reason=""):
"If you have configured your browser to disable cookies, please "
"re-enable them, at least for this site, or for 'same-origin' "
"requests."),
})
}
return HttpResponseForbidden(t.render(c), content_type='text/html')