From bdf30b952c66701075bb7cbbbd3467d3e908fe62 Mon Sep 17 00:00:00 2001 From: jedidiah Date: Wed, 8 Nov 2023 12:08:50 +0300 Subject: [PATCH] Fixed #34919 -- Added scope attribute to admindocs model templates. --- .../templates/admin_doc/model_detail.html | 12 ++++++------ .../admindocs/templates/admin_doc/model_index.html | 2 +- tests/admin_docs/test_views.py | 14 ++++++++++++++ 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 ebeeafc8e80..d4a380aa389 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 @@ - - - + + + @@ -55,9 +55,9 @@
{% translate 'Field' %}{% translate 'Type' %}{% translate 'Description' %}{% translate 'Field' %}{% translate 'Type' %}{% translate 'Description' %}
- - - + + + diff --git a/django/contrib/admindocs/templates/admin_doc/model_index.html b/django/contrib/admindocs/templates/admin_doc/model_index.html index 2342be4ba6f..b3ecb7ce9c2 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 @@
{% translate 'Method' %}{% translate 'Arguments' %}{% translate 'Description' %}{% translate 'Method' %}{% translate 'Arguments' %}{% translate 'Description' %}
{% for model in group.list %} - + {% endfor %}
{{ model.object_name }}{{ model.object_name }}
diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py index 7969f6cd42f..bf469181b30 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'{table_header}', count=count + ) + def test_method_excludes(self): """ Methods that begin with strings defined in