Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed deprecated admin contrib app AdminSite root_path attribute. R…

…efs #15294, r11250, r16136.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16575 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ff9a66675301cf716a6af1a246636a6cfc4395fd 1 parent 5120f01
Ramiro Morales ramiro authored
1  django/contrib/admin/actions.py
View
@@ -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,
}
6 django/contrib/admin/options.py
View
@@ -726,7 +726,6 @@ def render_change_form(self, request, context, add=False, change=False, form_url
'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 @@ def add_view(self, request, form_url='', extra_context=None):
'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 @@ def change_view(self, request, object_id, extra_context=None):
'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 @@ def changelist_view(self, request, extra_context=None):
'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 @@ def delete_view(self, request, object_id, extra_context=None):
"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 @@ def history_view(self, request, object_id, extra_context=None):
'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 {})
9 django/contrib/admin/sites.py
View
@@ -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 @@ def password_change(self, request):
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 @@ def login(self, request, extra_context=None):
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 @@ def index(self, request, extra_context=None):
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 @@ def app_index(self, request, app_label, extra_context=None):
context = {
'title': _('%s administration') % capfirst(app_label),
'app_list': [app_dict],
- 'root_path': self.root_path,
}
context.update(extra_context or {})
14 django/contrib/admin/templates/admin/base.html
View
@@ -32,19 +32,9 @@
{% if docsroot %}
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
{% endif %}
- {% url 'admin:password_change' as password_change_url %}
- {% if password_change_url %}
- <a href="{{ password_change_url }}">
- {% else %}
- <a href="{{ root_path }}password_change/">
- {% endif %}
+ <a href="{% url 'admin:password_change' %}">
{% trans 'Change password' %}</a> /
- {% url 'admin:logout' as logout_url %}
- {% if logout_url %}
- <a href="{{ logout_url }}">
- {% else %}
- <a href="{{ root_path }}logout/">
- {% endif %}
+ <a href="{% url 'admin:logout' %}">
{% trans 'Log out' %}</a>
{% endblock %}
</div>
6 django/contrib/admin/widgets.py
View
@@ -228,14 +228,10 @@ def _media(self):
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'<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
1  django/contrib/auth/admin.py
View
@@ -136,7 +136,6 @@ def user_change_password(self, request, id):
'original': user,
'save_as': False,
'show_save': True,
- 'root_path': self.admin_site.root_path,
}
return TemplateResponse(request, [
self.change_user_password_template or
Please sign in to comment.
Something went wrong with that request. Please try again.