#35867: admindocs links are not generated on Views documentation
------------------------------------+------------------------------------
     Reporter:  Lucas Brandstätter  |                    Owner:  (none)
         Type:  Bug                 |                   Status:  new
    Component:  contrib.admindocs   |                  Version:  5.1
     Severity:  Normal              |               Resolution:
     Keywords:  admindocs           |             Triage Stage:  Accepted
    Has patch:  0                   |      Needs documentation:  0
  Needs tests:  0                   |  Patch needs improvement:  0
Easy pickings:  0                   |                    UI/UX:  0
------------------------------------+------------------------------------
Changes (by Sarah Boyce):

 * stage:  Unreviewed => Accepted

Comment:

 Thank you for the report!
 Replicated, here is an example testcase:
 {{{#!diff
 --- a/tests/admin_docs/test_views.py
 +++ b/tests/admin_docs/test_views.py
 @@ -89,6 +89,18 @@ class AdminDocViewTests(TestDataMixin,
 AdminDocsTestCase):
          # View docstring
          self.assertContains(response, "Base view for admindocs views.")

 +    def testview_docstring_links(self):
 +        summary = (
 +            '<h2 class="subhead"><p>This is a view for '
 +            '<a class="reference external"
 href="/admindocs/models/myapp.company/">'
 +            "myapp.Company</a></p></h2>"
 +        )
 +        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(
 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()
 }}}

 There is already a ticket for some issues of links in docstrings #27409. I
 will accept but this might be combined with 27409 in future.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070192d2763ac1-ca76adda-6187-4810-a300-21691ef57601-000000%40eu-central-1.amazonses.com.

Reply via email to