From b5288e732c7a0c26034fa7a630939578551f6638 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 1 Dec 2005 07:03:23 +0000 Subject: [PATCH] Fixed #951 -- Admin bookmarklets no longer assume admin is rooted at '/' git-svn-id: http://code.djangoproject.com/svn/django/trunk@1522 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/templates/admin_doc/bookmarklets.html | 6 +++--- django/contrib/admin/views/doc.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/django/contrib/admin/templates/admin_doc/bookmarklets.html b/django/contrib/admin/templates/admin_doc/bookmarklets.html index 6525014437..94122d0387 100644 --- a/django/contrib/admin/templates/admin_doc/bookmarklets.html +++ b/django/contrib/admin/templates/admin_doc/bookmarklets.html @@ -16,16 +16,16 @@ your computer is "internal").

{% endblocktrans %}
-

{% trans "Documentation for this page" %}

+

{% trans "Documentation for this page" %}

{% trans "Jumps you from any page to the documentation for the view that generates that page." %}

{% trans "Show object ID" %}

{% trans "Shows the content-type and unique ID for pages that represent a single object." %}

-

{% trans "Edit this object (current window)" %}

+

{% trans "Edit this object (current window)" %}

{% trans "Jumps to the admin page for pages that represent a single object." %}

-

{% trans "Edit this object (new window)" %}

+

{% trans "Edit this object (new window)" %}

{% trans "As above, but opens the admin page in a new window." %}

diff --git a/django/contrib/admin/views/doc.py b/django/contrib/admin/views/doc.py index 3a36582326..5d73933139 100644 --- a/django/contrib/admin/views/doc.py +++ b/django/contrib/admin/views/doc.py @@ -19,8 +19,10 @@ def doc_index(request): doc_index = staff_member_required(doc_index) def bookmarklets(request): + # Hack! This couples this view to the URL it lives at. + admin_root = request.path[:-len('doc/bookmarklets/')] return render_to_response('admin_doc/bookmarklets', { - 'admin_url': "%s://%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', request.META['HTTP_HOST']), + 'admin_url': "%s://%s%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', request.META['HTTP_HOST'], admin_root), }, context_instance=DjangoContext(request)) bookmarklets = staff_member_required(bookmarklets)