diff options
author | CHI Cheng <cloudream@gmail.com> | 2018-05-03 16:57:18 +1000 |
---|---|---|
committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2018-05-03 08:57:18 +0200 |
commit | 98019df855fb8fb93e4e9505afeedcad29da3125 (patch) | |
tree | a5e15a4991170cf27cb0f77e1ccc3d0e5822b71d | |
parent | 9e861859366bfe60b584b7737a706031eed4c0aa (diff) | |
download | django-98019df855fb8fb93e4e9505afeedcad29da3125.tar.gz |
Used double quotation marks for csrf form element.
-rw-r--r-- | django/template/defaulttags.py | 2 | ||||
-rw-r--r-- | tests/csrf_tests/tests.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 43c557f179..762791be31 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -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 diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index e63fbb8bd6..d9e57178e4 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -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)), |