Opened 8 years ago

Closed 9 days ago

#27409 closed New feature (fixed)

Issues with admindocs docstring links generation

Reported by: Kris Avi Owned by: SAI GANESH S
Component: contrib.admindocs Version: 1.10
Severity: Normal Keywords:
Cc: SAI GANESH S Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Mariusz Felisiak)

Referring to:
https://docs.djangoproject.com/en/1.10/ref/contrib/admin/admindocs/

It seems the link generation isn't working as it should.

Let's say you want to generate link to tag "safe", then you have to use :tag:`built_in-safe` and it will generate link like "built_in-safe", whereas it may be better, if link text would be only the tag name or "safe". Same case with filters.

For views you can use generic class based views, in there by naming conventions can be capital letters. Class based views are classes and not methods and the naming of the view can be like BlogView or BlogEdit. But if generating link using the directives according to documentation it will not work since it will try to find view by name of "blogview" instead of "BlogView". It will automatically put it to lowercase and may make it not working. (Moved to the separate ticket, see #34286).

Also after some experimenting, it seems like :view:`app_label.view_name` would not work, and have to use full path like: :view:`app_name.app_label.views.view_name`

Change History (9)

comment:1 by Tim Graham, 8 years ago

Summary: Django Admindocs links generationIssues with admindocs docstring links generation
Triage Stage: UnreviewedAccepted

For future reference, please limit a ticket to one issue. I thought it might be possible to workaround the first issue with :tag:`safe <built_in-safe>` but this doesn't work. Not sure why, but I'll accept the ticket for further investigation. If someone wants to address either issue here, we can open a separate ticket for the other one. I didn't investigate the second one.

comment:2 by Kris Avi, 8 years ago

For my own environment I made workaround that will disappear with new django update. It doesn't have any tests written, and I am sure that is not python way to solve that issue.
https://github.com/krisavi/django/commit/f7ff7d149ec5b8d278414ef7229a97945d371368

But I see it could be a good idea to add optional "link name" parameter for all of them, upon omiting it, the full location will be used. That would even work quite well.

comment:3 by Mariusz Felisiak, 22 months ago

Description: modified (diff)

comment:4 by Sarah Boyce, 3 weeks ago

#35867 is related

comment:5 by SAI GANESH S, 2 weeks ago

Cc: SAI GANESH S added
Owner: changed from nobody to SAI GANESH S
Status: newassigned

comment:7 by Sarah Boyce, 11 days ago

Patch needs improvement: set

comment:8 by Sarah Boyce, 9 days ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:9 by Sarah Boyce <42296566+sarahboyce@…>, 9 days ago

Resolution: fixed
Status: assignedclosed

In c2c544c:

Fixed #27409 -- Made admindocs support custom link text in docstrings.

Note: See TracTickets for help on using tickets.
Back to Top