Used double quotation marks for csrf form element.
This commit is contained in:
parent
9e86185936
commit
98019df855
|
@ -54,7 +54,7 @@ class CsrfTokenNode(Node):
|
||||||
if csrf_token == 'NOTPROVIDED':
|
if csrf_token == 'NOTPROVIDED':
|
||||||
return format_html("")
|
return format_html("")
|
||||||
else:
|
else:
|
||||||
return format_html("<input type='hidden' name='csrfmiddlewaretoken' value='{}'>", csrf_token)
|
return format_html('<input type="hidden" name="csrfmiddlewaretoken" value="{}">', csrf_token)
|
||||||
else:
|
else:
|
||||||
# It's very probable that the token is missing because of
|
# It's very probable that the token is missing because of
|
||||||
# misconfiguration, so we raise a warning
|
# misconfiguration, so we raise a warning
|
||||||
|
|
|
@ -64,7 +64,7 @@ class CsrfViewMiddlewareTestMixin:
|
||||||
|
|
||||||
def _check_token_present(self, response, csrf_id=None):
|
def _check_token_present(self, response, csrf_id=None):
|
||||||
text = str(response.content, response.charset)
|
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
|
csrf_token = csrf_id or self._csrf_id
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
match and equivalent_tokens(csrf_token, match.group(1)),
|
match and equivalent_tokens(csrf_token, match.group(1)),
|
||||||
|
|
Loading…
Reference in New Issue