[Django] #35867: admindocs links are not generated on Views documentation

13 views
Skip to first unread message

Django

unread,
Oct 26, 2024, 7:21:02 PM10/26/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-----------------------------+---------------------------------------------
Reporter: Roang-zero1 | Type: Bug
Status: new | Component: contrib.admindocs
Version: 5.1 | Severity: Normal
Keywords: admindocs | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------------
When I use the admindocs app to generate a documentation on a view the
special markup such as
{{{#!python
class MyModelFormView(FormView)
"""
This is a form view for :model:`core.Model`
"""
}}}
do not generate any links to the core.Model documentation.

When I use the same markup in a model docstring they work as expected an
generate a link to the corresponding model.
--
Ticket URL: <https://code.djangoproject.com/ticket/35867>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 26, 2024, 7:30:10 PM10/26/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-----------------------------------+--------------------------------------
Reporter: Roang-zero1 | Owner: (none)
Type: Bug | Status: new
Component: contrib.admindocs | Version: 5.1
Severity: Normal | Resolution:
Keywords: admindocs | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Comment (by Roang-zero1):

Just realized that this only applies to the first line of the docstring

{{{
This is a form view for :model:`core.Model` <- Does not generate a link

In this view a :model:`core.Model` is modified <- Generates a link
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:1>

Django

unread,
Oct 28, 2024, 5:30:22 AM10/28/24
to django-...@googlegroups.com
#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

unread,
Oct 31, 2024, 6:34:42 AM10/31/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-------------------------------------+-------------------------------------
Reporter: Lucas Brandstätter | Owner: SAI
| GANESH S
Type: Bug | Status: assigned
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 SAI GANESH S):

* cc: SAI GANESH S (added)
* owner: (none) => SAI GANESH S
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:3>

Django

unread,
Oct 31, 2024, 10:26:39 AM10/31/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-------------------------------------+-------------------------------------
Reporter: Lucas Brandstätter | Owner: SAI
| GANESH S
Type: Bug | Status: assigned
Component: contrib.admindocs | Version: 5.1
Severity: Normal | Resolution:
Keywords: admindocs | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by SAI GANESH S):

* has_patch: 0 => 1

Comment:

PR Link:
https://github.com/django/django/pull/18747
--
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:4>

Django

unread,
Nov 1, 2024, 4:44:48 AM11/1/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-------------------------------------+-------------------------------------
Reporter: Lucas Brandstätter | Owner: SAI
| GANESH S
Type: Bug | Status: assigned
Component: contrib.admindocs | Version: 5.1
Severity: Normal | Resolution:
Keywords: admindocs | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:5>

Django

unread,
Nov 1, 2024, 6:43:27 AM11/1/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-------------------------------------+-------------------------------------
Reporter: Lucas Brandstätter | Owner: SAI
| GANESH S
Type: Bug | Status: assigned
Component: contrib.admindocs | Version: 5.1
Severity: Normal | Resolution:
Keywords: admindocs | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:6>

Django

unread,
Nov 4, 2024, 3:49:40 AM11/4/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-------------------------------------+-------------------------------------
Reporter: Lucas Brandstätter | Owner: SAI
| GANESH S
Type: Bug | Status: assigned
Component: contrib.admindocs | Version: 5.1
Severity: Normal | Resolution:
Keywords: admindocs | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:7>

Django

unread,
Nov 4, 2024, 4:43:15 AM11/4/24
to django-...@googlegroups.com
#35867: admindocs links are not generated on Views documentation
-------------------------------------+-------------------------------------
Reporter: Lucas Brandstätter | Owner: SAI
| GANESH S
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 5.1
Severity: Normal | Resolution: fixed
Keywords: admindocs | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"968397228fe03968bb855856532569586c8a8a1c" 96839722]:
{{{#!CommitTicketReference repository=""
revision="968397228fe03968bb855856532569586c8a8a1c"
Fixed #35867, Refs #2411 -- Allowed links in admindocs view details
summary.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35867#comment:8>
Reply all
Reply to author
Forward
0 new messages