summaryrefslogtreecommitdiff
path: root/tests/admin_docs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/admin_docs')
-rw-r--r--tests/admin_docs/models.py10
-rw-r--r--tests/admin_docs/test_views.py19
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/admin_docs/models.py b/tests/admin_docs/models.py
index b4ef84caba..4b52b4a4ea 100644
--- a/tests/admin_docs/models.py
+++ b/tests/admin_docs/models.py
@@ -15,6 +15,16 @@ class Group(models.Model):
class Family(models.Model):
+ """
+ Links with different link text.
+
+ This is a line with tag :tag:`extends <built_in-extends>`
+ This is a line with model :model:`Family <myapp.Family>`
+ This is a line with view :view:`Index <myapp.views.Index>`
+ This is a line with template :template:`index template <Index.html>`
+ This is a line with filter :filter:`example filter <filtername>`
+ """
+
last_name = models.CharField(max_length=200)
diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py
index c48a89a1b0..f7232a7e03 100644
--- a/tests/admin_docs/test_views.py
+++ b/tests/admin_docs/test_views.py
@@ -441,6 +441,25 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
self.assertContains(self.response, body, html=True)
self.assertContains(self.response, model_body, html=True)
+ def test_model_docstring_built_in_tag_links(self):
+ summary = "Links with different link text."
+ body = (
+ '<p>This is a line with tag <a class="reference external" '
+ 'href="/admindocs/tags/#built_in-extends">extends</a>\n'
+ 'This is a line with model <a class="reference external" '
+ 'href="/admindocs/models/myapp.family/">Family</a>\n'
+ 'This is a line with view <a class="reference external" '
+ 'href="/admindocs/views/myapp.views.Index/">Index</a>\n'
+ 'This is a line with template <a class="reference external" '
+ 'href="/admindocs/templates/Index.html/">index template</a>\n'
+ 'This is a line with filter <a class="reference external" '
+ 'href="/admindocs/filters/#filtername">example filter</a></p>'
+ )
+ url = reverse("django-admindocs-models-detail", args=["admin_docs", "family"])
+ response = self.client.get(url)
+ self.assertContains(response, summary, html=True)
+ self.assertContains(response, body, html=True)
+
def test_model_detail_title(self):
self.assertContains(self.response, "<h1>admin_docs.Person</h1>", html=True)