diff --git a/django/contrib/admin/actions.py b/django/contrib/admin/actions.py
index bd661f3f3e7..5b56402428a 100644
--- a/django/contrib/admin/actions.py
+++ b/django/contrib/admin/actions.py
@@ -69,7 +69,6 @@ def delete_selected(modeladmin, request, queryset):
"perms_lacking": perms_needed,
"protected": protected,
"opts": opts,
- "root_path": modeladmin.admin_site.root_path,
"app_label": app_label,
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
}
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index ec5dac5b672..b0eb1133594 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -726,7 +726,6 @@ class ModelAdmin(BaseModelAdmin):
'content_type_id': ContentType.objects.get_for_model(self.model).id,
'save_as': self.save_as,
'save_on_top': self.save_on_top,
- 'root_path': self.admin_site.root_path,
})
if add and self.add_form_template is not None:
form_template = self.add_form_template
@@ -962,7 +961,6 @@ class ModelAdmin(BaseModelAdmin):
'media': mark_safe(media),
'inline_admin_formsets': inline_admin_formsets,
'errors': helpers.AdminErrorList(form, formsets),
- 'root_path': self.admin_site.root_path,
'app_label': opts.app_label,
}
context.update(extra_context or {})
@@ -1053,7 +1051,6 @@ class ModelAdmin(BaseModelAdmin):
'media': mark_safe(media),
'inline_admin_formsets': inline_admin_formsets,
'errors': helpers.AdminErrorList(form, formsets),
- 'root_path': self.admin_site.root_path,
'app_label': opts.app_label,
}
context.update(extra_context or {})
@@ -1195,7 +1192,6 @@ class ModelAdmin(BaseModelAdmin):
'cl': cl,
'media': media,
'has_add_permission': self.has_add_permission(request),
- 'root_path': self.admin_site.root_path,
'app_label': app_label,
'action_form': action_form,
'actions_on_top': self.actions_on_top,
@@ -1260,7 +1256,6 @@ class ModelAdmin(BaseModelAdmin):
"perms_lacking": perms_needed,
"protected": protected,
"opts": opts,
- "root_path": self.admin_site.root_path,
"app_label": app_label,
}
context.update(extra_context or {})
@@ -1288,7 +1283,6 @@ class ModelAdmin(BaseModelAdmin):
'action_list': action_list,
'module_name': capfirst(force_unicode(opts.verbose_name_plural)),
'object': obj,
- 'root_path': self.admin_site.root_path,
'app_label': app_label,
}
context.update(extra_context or {})
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index a0338ee6017..1c6dba6b4dc 100644
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -41,7 +41,6 @@ class AdminSite(object):
def __init__(self, name=None, app_name='admin'):
self._registry = {} # model_class class -> admin_class instance
- self.root_path = None
if name is None:
self.name = 'admin'
else:
@@ -254,10 +253,7 @@ class AdminSite(object):
Handles the "change password" task -- both form display and validation.
"""
from django.contrib.auth.views import password_change
- if self.root_path is not None:
- url = '%spassword_change/done/' % self.root_path
- else:
- url = reverse('admin:password_change_done', current_app=self.name)
+ url = reverse('admin:password_change_done', current_app=self.name)
defaults = {
'current_app': self.name,
'post_change_redirect': url
@@ -316,7 +312,6 @@ class AdminSite(object):
from django.contrib.auth.views import login
context = {
'title': _('Log in'),
- 'root_path': self.root_path,
'app_path': request.get_full_path(),
REDIRECT_FIELD_NAME: request.get_full_path(),
}
@@ -373,7 +368,6 @@ class AdminSite(object):
context = {
'title': _('Site administration'),
'app_list': app_list,
- 'root_path': self.root_path,
}
context.update(extra_context or {})
return TemplateResponse(request, [
@@ -416,7 +410,6 @@ class AdminSite(object):
context = {
'title': _('%s administration') % capfirst(app_label),
'app_list': [app_dict],
- 'root_path': self.root_path,
}
context.update(extra_context or {})
diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html
index 9034ae85228..928244053fd 100644
--- a/django/contrib/admin/templates/admin/base.html
+++ b/django/contrib/admin/templates/admin/base.html
@@ -32,19 +32,9 @@
{% if docsroot %}
{% trans 'Documentation' %} /
{% endif %}
- {% url 'admin:password_change' as password_change_url %}
- {% if password_change_url %}
-
- {% else %}
-
- {% endif %}
+
{% trans 'Change password' %} /
- {% url 'admin:logout' as logout_url %}
- {% if logout_url %}
-
- {% else %}
-
- {% endif %}
+
{% trans 'Log out' %}
{% endblock %}
diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
index d0269a95f2d..713ce638314 100644
--- a/django/contrib/admin/widgets.py
+++ b/django/contrib/admin/widgets.py
@@ -228,14 +228,10 @@ class RelatedFieldWidgetWrapper(forms.Widget):
def render(self, name, value, *args, **kwargs):
rel_to = self.rel.to
info = (rel_to._meta.app_label, rel_to._meta.object_name.lower())
- try:
- related_url = reverse('admin:%s_%s_add' % info, current_app=self.admin_site.name)
- except NoReverseMatch:
- info = (self.admin_site.root_path, rel_to._meta.app_label, rel_to._meta.object_name.lower())
- related_url = '%s%s/%s/add/' % info
self.widget.choices = self.choices
output = [self.widget.render(name, value, *args, **kwargs)]
if self.can_add_related:
+ related_url = reverse('admin:%s_%s_add' % info, current_app=self.admin_site.name)
# TODO: "id_" is hard-coded here. This should instead use the correct
# API to determine the ID dynamically.
output.append(u' '
diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py
index 237b15364e4..5a8bdc22467 100644
--- a/django/contrib/auth/admin.py
+++ b/django/contrib/auth/admin.py
@@ -136,7 +136,6 @@ class UserAdmin(admin.ModelAdmin):
'original': user,
'save_as': False,
'show_save': True,
- 'root_path': self.admin_site.root_path,
}
return TemplateResponse(request, [
self.change_user_password_template or