From 968397228fe03968bb855856532569586c8a8a1c Mon Sep 17 00:00:00 2001
From: sai-ganesh-03 ", "").replace(" Stores information about a person, related to '
+ '{{ name }}
-{{ summary|striptags }}
+{{ summary }}
{{ body }}
diff --git a/django/contrib/admindocs/utils.py b/django/contrib/admindocs/utils.py
index 3708a32813..3a7ca4e781 100644
--- a/django/contrib/admindocs/utils.py
+++ b/django/contrib/admindocs/utils.py
@@ -242,3 +242,7 @@ def remove_non_capturing_groups(pattern):
final_pattern += pattern[prev_end:start]
prev_end = end
return final_pattern + pattern[prev_end:]
+
+
+def strip_p_tags(value):
+ return mark_safe(value.replace("This is a view for '
+ ''
+ "myapp.Company
"
+ )
+ url = reverse(
+ "django-admindocs-views-detail", args=["admin_docs.views.CompanyView"]
+ )
+ response = self.client.get(url)
+ self.assertContains(response, summary, html=True)
+
@override_settings(ROOT_URLCONF="admin_docs.namespace_urls")
def test_namespaced_view_detail(self):
url = reverse(
@@ -408,9 +420,9 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
def test_model_docstring_renders_correctly(self):
summary = (
- 'Stores information about a person, related to '
''
- "myapp.Company.
Notes
" body = ( diff --git a/tests/admin_docs/urls.py b/tests/admin_docs/urls.py index de23d9baf5..779d5f9f5f 100644 --- a/tests/admin_docs/urls.py +++ b/tests/admin_docs/urls.py @@ -14,6 +14,7 @@ urlpatterns = [ path("admin/", admin.site.urls), path("admindocs/", include("django.contrib.admindocs.urls")), path("", include(ns_patterns, namespace="test")), + path("company/", views.CompanyView.as_view()), path("xview/func/", views.xview_dec(views.xview)), path("xview/class/", views.xview_dec(views.XViewClass.as_view())), path("xview/callable_object/", views.xview_dec(views.XViewCallableObject())), diff --git a/tests/admin_docs/views.py b/tests/admin_docs/views.py index 21fe382bba..5bccaf29a0 100644 --- a/tests/admin_docs/views.py +++ b/tests/admin_docs/views.py @@ -18,3 +18,12 @@ class XViewClass(View): class XViewCallableObject(View): def __call__(self, request): return HttpResponse() + + +class CompanyView(View): + """ + This is a view for :model:`myapp.Company` + """ + + def get(self, request): + return HttpResponse()