summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjedidiah <jedidahfavour@gmail.com>2023-11-08 12:08:50 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-11-14 05:34:56 +0100
commitbdf30b952c66701075bb7cbbbd3467d3e908fe62 (patch)
tree89f59a29752720c82082aa41507c3c8553d709d3
parentad41f1c53aa9f2c938df32e4386d8a80138923fc (diff)
Fixed #34919 -- Added scope attribute to admindocs model templates.
-rw-r--r--django/contrib/admindocs/templates/admin_doc/model_detail.html12
-rw-r--r--django/contrib/admindocs/templates/admin_doc/model_index.html2
-rw-r--r--tests/admin_docs/test_views.py14
3 files changed, 21 insertions, 7 deletions
diff --git a/django/contrib/admindocs/templates/admin_doc/model_detail.html b/django/contrib/admindocs/templates/admin_doc/model_detail.html
index ebeeafc8e8..d4a380aa38 100644
--- a/django/contrib/admindocs/templates/admin_doc/model_detail.html
+++ b/django/contrib/admindocs/templates/admin_doc/model_detail.html
@@ -32,9 +32,9 @@
<table class="model">
<thead>
<tr>
- <th>{% translate 'Field' %}</th>
- <th>{% translate 'Type' %}</th>
- <th>{% translate 'Description' %}</th>
+ <th scope="col">{% translate 'Field' %}</th>
+ <th scope="col">{% translate 'Type' %}</th>
+ <th scope="col">{% translate 'Description' %}</th>
</tr>
</thead>
<tbody>
@@ -55,9 +55,9 @@
<table class="model">
<thead>
<tr>
- <th>{% translate 'Method' %}</th>
- <th>{% translate 'Arguments' %}</th>
- <th>{% translate 'Description' %}</th>
+ <th scope="col">{% translate 'Method' %}</th>
+ <th scope="col">{% translate 'Arguments' %}</th>
+ <th scope="col">{% translate 'Description' %}</th>
</tr>
</thead>
<tbody>
diff --git a/django/contrib/admindocs/templates/admin_doc/model_index.html b/django/contrib/admindocs/templates/admin_doc/model_index.html
index 2342be4ba6..b3ecb7ce9c 100644
--- a/django/contrib/admindocs/templates/admin_doc/model_index.html
+++ b/django/contrib/admindocs/templates/admin_doc/model_index.html
@@ -27,7 +27,7 @@
<table class="xfull">
{% for model in group.list %}
<tr>
-<th><a href="{% url 'django-admindocs-models-detail' app_label=model.app_label model_name=model.model_name %}">{{ model.object_name }}</a></th>
+<th scope="col"><a href="{% url 'django-admindocs-models-detail' app_label=model.app_label model_name=model.model_name %}">{{ model.object_name }}</a></th>
</tr>
{% endfor %}
</table>
diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py
index 7969f6cd42..bf469181b3 100644
--- a/tests/admin_docs/test_views.py
+++ b/tests/admin_docs/test_views.py
@@ -240,6 +240,20 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
reverse("django-admindocs-models-detail", args=["admin_docs", "Person"])
)
+ def test_table_headers(self):
+ tests = [
+ ("Method", 1),
+ ("Arguments", 1),
+ ("Description", 2),
+ ("Field", 1),
+ ("Type", 1),
+ ("Method", 1),
+ ]
+ for table_header, count in tests:
+ self.assertContains(
+ self.response, f'<th scope="col">{table_header}</th>', count=count
+ )
+
def test_method_excludes(self):
"""
Methods that begin with strings defined in