diff --git a/django/views/templates/csrf_403.html b/django/views/templates/csrf_403.html index 42fea9911b..ee81b04bcc 100644 --- a/django/views/templates/csrf_403.html +++ b/django/views/templates/csrf_403.html @@ -53,7 +53,7 @@
  • Your browser is accepting cookies.
  • The view function passes a request to the template’s render + href="https://docs.djangoproject.com/en/{{ docs_version }}/topics/templates/#django.template.backends.base.Template.render">render method.
  • In the template, there is a {% templatetag openblock %} csrf_token diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py index af16ffd740..2d530cc586 100644 --- a/tests/view_tests/tests/test_csrf.py +++ b/tests/view_tests/tests/test_csrf.py @@ -132,3 +132,15 @@ class CsrfViewTests(SimpleTestCase): with mock.patch.object(Path, "open") as m: csrf_failure(mock.MagicMock(), mock.Mock()) m.assert_called_once_with(encoding="utf-8") + + @override_settings(DEBUG=True) + @mock.patch("django.views.csrf.get_docs_version", return_value="4.2") + def test_doc_links(self, mocked_get_complete_version): + response = self.client.post("/") + self.assertContains(response, "Forbidden", status_code=403) + self.assertNotContains( + response, "https://docs.djangoproject.com/en/dev/", status_code=403 + ) + self.assertContains( + response, "https://docs.djangoproject.com/en/4.2/", status_code=403 + )