Code

Opened 6 years ago

Closed 5 years ago

Last modified 3 years ago

#8971 closed (fixed)

URL resolution for admindocs reST roles incorrect

Reported by: benspaulding Owned by: mitsuhiko
Component: contrib.admin Version: master
Severity: Keywords: admindocs urls
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The parse_rst method in admindocs/utils.py has a link_base argument set to "../.." — that works fine if the the link being created is in either the model_detail or view_detail view. But if the view is being created in the tag_index or detail_index the url does not resolve correctly.

The attached patch is a solid solution, but possibly temporary. It simply has the tag_index and model_index views pass parse_rst a link_base kwarg set to the correct relative URL. I think a better solution would be to have the roles’ URLs use reverse() rather than be hard-coded. I tried to do that, but it is difficult as reverse() needs views.py to resolve the URL and views.py relies on utils.py. I am sure it can be done, but I couldn’t figure out how.

Attachments (2)

admindocs-link_base.diff (2.0 KB) - added by benspaulding 6 years ago.
8971-reverse.patch (1.1 KB) - added by mitsuhiko 5 years ago.
reverses the url to the root properly

Download all attachments as: .zip

Change History (10)

Changed 6 years ago by benspaulding

comment:1 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by russellm

  • Component changed from Uncategorized to django.contrib.admin

comment:3 Changed 5 years ago by mitsuhiko

  • Owner changed from nobody to mitsuhiko

comment:4 Changed 5 years ago by mitsuhiko

Attached a patch that drops link_base and reverses the url to the root properly.

Changed 5 years ago by mitsuhiko

reverses the url to the root properly

comment:5 Changed 5 years ago by mitsuhiko

  • Triage Stage changed from Accepted to Ready for checkin

Ready for commit :-)

comment:6 Changed 5 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(In [10683]) Fixed #8971: correctly reverse urls in admindocs reST roles. Thanks, mitsuhiko.

comment:7 Changed 5 years ago by jacob

(In [10685]) [1.0.X] Fixed #8971: correctly reverse urls in admindocs reST roles. Thanks, mitsuhiko. Backport of [10683] from trunk.

comment:8 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.