Used double quotation marks for csrf form element.

This commit is contained in:
CHI Cheng 2018-05-03 16:57:18 +10:00 committed by Carlton Gibson
parent 9e86185936
commit 98019df855
2 changed files with 2 additions and 2 deletions

View File

@ -54,7 +54,7 @@ class CsrfTokenNode(Node):
if csrf_token == 'NOTPROVIDED':
return format_html("")
else:
return format_html("<input type='hidden' name='csrfmiddlewaretoken' value='{}'>", csrf_token)
return format_html('<input type="hidden" name="csrfmiddlewaretoken" value="{}">', csrf_token)
else:
# It's very probable that the token is missing because of
# misconfiguration, so we raise a warning

View File

@ -64,7 +64,7 @@ class CsrfViewMiddlewareTestMixin:
def _check_token_present(self, response, csrf_id=None):
text = str(response.content, response.charset)
match = re.search("name='csrfmiddlewaretoken' value='(.*?)'", text)
match = re.search('name="csrfmiddlewaretoken" value="(.*?)"', text)
csrf_token = csrf_id or self._csrf_id
self.assertTrue(
match and equivalent_tokens(csrf_token, match.group(1)),