浏览代码

Fixed #34911 -- Corrected HTML heading levels on admindocs' main page.

laserhyena 1 年之前
父节点
当前提交
21382e2743
共有 2 个文件被更改,包括 16 次插入5 次删除
  1. 5 5
      django/contrib/admindocs/templates/admin_doc/index.html
  2. 11 0
      tests/admin_views/tests.py

+ 5 - 5
django/contrib/admindocs/templates/admin_doc/index.html

@@ -14,19 +14,19 @@
 <h1>{% translate 'Documentation' %}</h1>
 
 <div id="content-main">
-  <h3><a href="tags/">{% translate 'Tags' %}</a></h3>
+  <h2><a href="tags/">{% translate 'Tags' %}</a></h2>
   <p>{% translate 'List of all the template tags and their functions.' %}</p>
 
-  <h3><a href="filters/">{% translate 'Filters' %}</a></h3>
+  <h2><a href="filters/">{% translate 'Filters' %}</a></h2>
   <p>{% translate 'Filters are actions which can be applied to variables in a template to alter the output.' %}</p>
 
-  <h3><a href="models/">{% translate 'Models' %}</a></h3>
+  <h2><a href="models/">{% translate 'Models' %}</a></h2>
   <p>{% translate 'Models are descriptions of all the objects in the system and their associated fields. Each model has a list of fields which can be accessed as template variables' %}.</p>
 
-  <h3><a href="views/">{% translate 'Views' %}</a></h3>
+  <h2><a href="views/">{% translate 'Views' %}</a></h2>
   <p>{% translate 'Each page on the public site is generated by a view. The view defines which template is used to generate the page and which objects are available to that template.' %}</p>
 
-  <h3><a href="bookmarklets/">{% translate 'Bookmarklets' %}</a></h3>
+  <h2><a href="bookmarklets/">{% translate 'Bookmarklets' %}</a></h2>
   <p>{% translate 'Tools for your browser to quickly access admin functionality.' %}</p>
 </div>
 

+ 11 - 0
tests/admin_views/tests.py

@@ -7583,6 +7583,17 @@ class AdminDocsTest(TestCase):
             response, '<li><a href="#built_in-add">add</a></li>', html=True
         )
 
+    def test_index_headers(self):
+        response = self.client.get(reverse("django-admindocs-docroot"))
+        self.assertContains(response, "<h1>Documentation</h1>")
+        self.assertContains(response, '<h2><a href="tags/">Tags</a></h2>')
+        self.assertContains(response, '<h2><a href="filters/">Filters</a></h2>')
+        self.assertContains(response, '<h2><a href="models/">Models</a></h2>')
+        self.assertContains(response, '<h2><a href="views/">Views</a></h2>')
+        self.assertContains(
+            response, '<h2><a href="bookmarklets/">Bookmarklets</a></h2>'
+        )
+
 
 @override_settings(
     ROOT_URLCONF="admin_views.urls",