Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#8971 closed (fixed)

URL resolution for admindocs reST roles incorrect

Reported by: Ben Spaulding Owned by: Armin Ronacher
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 Ben Spaulding 8 years ago.
8971-reverse.patch (1.1 KB) - added by Armin Ronacher 7 years ago.
reverses the url to the root properly

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by Ben Spaulding

Attachment: admindocs-link_base.diff added

comment:1 Changed 8 years ago by Jacob

milestone: 1.1
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 8 years ago by Russell Keith-Magee

Component: Uncategorizeddjango.contrib.admin

comment:3 Changed 7 years ago by Armin Ronacher

Owner: changed from nobody to Armin Ronacher

comment:4 Changed 7 years ago by Armin Ronacher

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

Changed 7 years ago by Armin Ronacher

Attachment: 8971-reverse.patch added

reverses the url to the root properly

comment:5 Changed 7 years ago by Armin Ronacher

Triage Stage: AcceptedReady for checkin

Ready for commit :-)

comment:6 Changed 7 years ago by Jacob

Resolution: fixed
Status: newclosed

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

comment:7 Changed 7 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 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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