1
0
mirror of https://github.com/django/django.git synced 2025-10-30 17:16:10 +00:00

Changed a lot of internal code to use 'format_html' where appropriate/possible

This commit is contained in:
Luke Plant
2012-07-03 00:31:14 +01:00
parent bee498f3a2
commit a92e7f37c4
12 changed files with 121 additions and 93 deletions

View File

@@ -16,6 +16,7 @@ from django.template.smartif import IfParser, Literal
from django.template.defaultfilters import date
from django.utils.encoding import smart_unicode
from django.utils.safestring import mark_safe
from django.utils.html import format_html
from django.utils import timezone
register = Library()
@@ -44,9 +45,9 @@ class CsrfTokenNode(Node):
csrf_token = context.get('csrf_token', None)
if csrf_token:
if csrf_token == 'NOTPROVIDED':
return mark_safe("")
return format_html("")
else:
return mark_safe("<div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='%s' /></div>" % csrf_token)
return format_html("<div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='{}' /></div>", csrf_token)
else:
# It's very probable that the token is missing because of
# misconfiguration, so we raise a warning