Django

Code

Ticket #7466 (closed: fixed)

Opened 6 months ago

Last modified 3 months ago

newforms-admin: Handle relative paths in documentation templates

Reported by: handelaar <john@handelaar.org> Assigned to: jacob
Milestone: 1.0 Component: django.contrib.admin
Version: newforms-admin Keywords: relative links admin
Cc: cmawebsite@gmail.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

At some point between 0.96 and SVN-as-of-yesterday, the links in div#user-tools in the top right corner of the admin interface have become relative to the current page. This means they point to broken links at every location except /admin.

It looks and sounds a lot like #3491 (long since fixed) but because it obviously has a different cause so I'm opening a new ticket.

Attachments

fix-relative-paths-in-admin-doc.diff (23.2 kB) - added by shnur on 07/10/08 04:13:04.

Change History

06/28/08 12:00:34 changed by Karen Tracey <kmtracey@gmail.com>

  • needs_better_patch changed.
  • needs_tests changed.
  • version changed from SVN to newforms-admin.
  • milestone set to 1.0.
  • keywords changed from relative links admin to relative links admin nfa-blocker.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.

I cannot recreate any problem with the user-tools links in trunk r7776. At any rate problems with trunk admin are not worth fixing at this point, so I looked to see if this all works properly on newforms-admin, and here I do see one problem. So I'm moving this ticket over to newforms-admin for fixing that problem.

Where I see a problem in newforms-admin is when you follow the "Documentation" link (I am running with the patch for #6962 so the Documentation link actually works). Once you have followed the "Documentation" link the user-tools links start to exhibit problems. On the main Documentation index page there is a link to Documentation which is now (broken) '/admin/doc/doc' (change password and logout are broken also). Similarly if you go to /admin/doc/views the user-tools links are /admin/doc/views/doc/, /admin/doc/views/pasword_change/, etc. But if you go to a specific view detail the userlinks block is redefined in the template and 'Documentation' is dropped (why? it would be nice to have a link direct back to doc index instead of having to backtrack two pages) while change password and logout end up referring to the right urls, but only because the proper number of ../..s are hardcoded into the template which is an approach most of the other templates seem to have been moving away from.

Changeset 7638 made changes so that the admin site determined the root admin path and passed that value into templates. Many of the block userlinks overrides were removed from the admin templates. However this changeset doesn't seem to have done anything for the admin doc templates. I think the work of changeset 7638 needs to be extended to handle the doc views and templates.

Marking nfa-blocker since technically this is a regression from trunk, where all these links work properly.

07/02/08 07:26:15 changed by anonymous

  • summary changed from Return of broken relative links in admin user-tools to newforms-admin: Handle relative paths in documentation templates.

07/10/08 04:13:04 changed by shnur

  • attachment fix-relative-paths-in-admin-doc.diff added.

07/10/08 04:15:34 changed by shnur

I introduced new base template for admin docs which removes Documentation link from userlinks. Also all views from admindoc application now returns root_path template variable to properly create urls in templates.

07/10/08 04:16:03 changed by shnur

  • has_patch set to 1.

07/10/08 04:21:28 changed by shnur

  • owner changed from nobody to shnur.
  • status changed from new to assigned.

07/16/08 06:50:44 changed by anonymous

  • cc set to cmawebsite@gmail.com.

07/16/08 08:53:40 changed by brosner

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7934]) newforms-admin: Fixed #7466 -- Generate a root_path for admindocs views so the userlinks are properly linked. Thanks handelaar for the report.

07/17/08 08:31:52 changed by Karen Tracey <kmtracey@gmail.com>

  • status changed from closed to reopened.
  • resolution deleted.

Not all relative links are working after the fix. For example, if you go to Documentation -> Models -> auth.Permission the links are relative to that page and so do not work. Similarly for Documentation -> Models -> admin.LogEntry?. I put a print statement in where the root_path is calculated and it seems the problem is the app_label for these is 'contenttypes' instead of 'auth' or 'admin':

Django version 0.97-newforms-admin-SVN-7939, using settings 'xword.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
root_path for request.path /admin/doc/models/auth.group/, app_label auth, model_name group is: /admin/
[17/Jul/2008 09:11:52] "GET /admin/doc/models/auth.group/ HTTP/1.1" 200 2572
[17/Jul/2008 09:12:08] "GET /admin/doc/models/ HTTP/1.1" 200 3259
root_path for request.path /admin/doc/models/auth.permission/, app_label contenttypes, model_name permission is: /admin/doc/models/auth.permission/
[17/Jul/2008 09:12:11] "GET /admin/doc/models/auth.permission/ HTTP/1.1" 200 3262
[17/Jul/2008 09:24:40] "GET /admin/doc/models/ HTTP/1.1" 200 3259
root_path for request.path /admin/doc/models/auth.permission/, app_label contenttypes, model_name permission is: /admin/doc/models/auth.permission/
[17/Jul/2008 09:24:50] "GET /admin/doc/models/auth.permission/ HTTP/1.1" 200 3262
[17/Jul/2008 09:26:03] "GET /admin/doc/models/ HTTP/1.1" 200 3259
root_path for request.path /admin/doc/models/admin.logentry/, app_label contenttypes, model_name logentry is: /admin/doc/models/admin.logentry/
[17/Jul/2008 09:26:06] "GET /admin/doc/models/admin.logentry/ HTTP/1.1" 200 3250

I didn't do an exhaustive search nor much experimenting with routes other than 'Models' and I've run out of time for now so figured I'd just report this much.

07/17/08 11:00:27 changed by Karen Tracey <kmtracey@gmail.com>

  • keywords changed from relative links admin nfa-blocker to relative links admin.

Removing nfa-blocker because I don't believe fixing the remaining links should hold up a merge to trunk. Most of the problem is fixed in the current code.

08/29/08 10:42:26 changed by jacob

  • owner changed from shnur to jacob.
  • status changed from reopened to new.

08/29/08 10:42:31 changed by jacob

  • status changed from new to assigned.

08/29/08 14:32:49 changed by jacob

Fixed (well, for the most part) in [8718].

08/29/08 14:33:01 changed by jacob

  • status changed from assigned to closed.
  • resolution set to fixed.

Add/Change #7466 (newforms-admin: Handle relative paths in documentation templates)




Change Properties
Action