mirror of https://github.com/django/django.git
Removed deprecated admin contrib app AdminSite root_path attribute. Refs #15294, r11250, r16136.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16575 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5120f018da
commit
ff9a666753
|
@ -69,7 +69,6 @@ def delete_selected(modeladmin, request, queryset):
|
||||||
"perms_lacking": perms_needed,
|
"perms_lacking": perms_needed,
|
||||||
"protected": protected,
|
"protected": protected,
|
||||||
"opts": opts,
|
"opts": opts,
|
||||||
"root_path": modeladmin.admin_site.root_path,
|
|
||||||
"app_label": app_label,
|
"app_label": app_label,
|
||||||
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
|
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
|
||||||
}
|
}
|
||||||
|
|
|
@ -726,7 +726,6 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
'content_type_id': ContentType.objects.get_for_model(self.model).id,
|
'content_type_id': ContentType.objects.get_for_model(self.model).id,
|
||||||
'save_as': self.save_as,
|
'save_as': self.save_as,
|
||||||
'save_on_top': self.save_on_top,
|
'save_on_top': self.save_on_top,
|
||||||
'root_path': self.admin_site.root_path,
|
|
||||||
})
|
})
|
||||||
if add and self.add_form_template is not None:
|
if add and self.add_form_template is not None:
|
||||||
form_template = self.add_form_template
|
form_template = self.add_form_template
|
||||||
|
@ -962,7 +961,6 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
'media': mark_safe(media),
|
'media': mark_safe(media),
|
||||||
'inline_admin_formsets': inline_admin_formsets,
|
'inline_admin_formsets': inline_admin_formsets,
|
||||||
'errors': helpers.AdminErrorList(form, formsets),
|
'errors': helpers.AdminErrorList(form, formsets),
|
||||||
'root_path': self.admin_site.root_path,
|
|
||||||
'app_label': opts.app_label,
|
'app_label': opts.app_label,
|
||||||
}
|
}
|
||||||
context.update(extra_context or {})
|
context.update(extra_context or {})
|
||||||
|
@ -1053,7 +1051,6 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
'media': mark_safe(media),
|
'media': mark_safe(media),
|
||||||
'inline_admin_formsets': inline_admin_formsets,
|
'inline_admin_formsets': inline_admin_formsets,
|
||||||
'errors': helpers.AdminErrorList(form, formsets),
|
'errors': helpers.AdminErrorList(form, formsets),
|
||||||
'root_path': self.admin_site.root_path,
|
|
||||||
'app_label': opts.app_label,
|
'app_label': opts.app_label,
|
||||||
}
|
}
|
||||||
context.update(extra_context or {})
|
context.update(extra_context or {})
|
||||||
|
@ -1195,7 +1192,6 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
'cl': cl,
|
'cl': cl,
|
||||||
'media': media,
|
'media': media,
|
||||||
'has_add_permission': self.has_add_permission(request),
|
'has_add_permission': self.has_add_permission(request),
|
||||||
'root_path': self.admin_site.root_path,
|
|
||||||
'app_label': app_label,
|
'app_label': app_label,
|
||||||
'action_form': action_form,
|
'action_form': action_form,
|
||||||
'actions_on_top': self.actions_on_top,
|
'actions_on_top': self.actions_on_top,
|
||||||
|
@ -1260,7 +1256,6 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
"perms_lacking": perms_needed,
|
"perms_lacking": perms_needed,
|
||||||
"protected": protected,
|
"protected": protected,
|
||||||
"opts": opts,
|
"opts": opts,
|
||||||
"root_path": self.admin_site.root_path,
|
|
||||||
"app_label": app_label,
|
"app_label": app_label,
|
||||||
}
|
}
|
||||||
context.update(extra_context or {})
|
context.update(extra_context or {})
|
||||||
|
@ -1288,7 +1283,6 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
'action_list': action_list,
|
'action_list': action_list,
|
||||||
'module_name': capfirst(force_unicode(opts.verbose_name_plural)),
|
'module_name': capfirst(force_unicode(opts.verbose_name_plural)),
|
||||||
'object': obj,
|
'object': obj,
|
||||||
'root_path': self.admin_site.root_path,
|
|
||||||
'app_label': app_label,
|
'app_label': app_label,
|
||||||
}
|
}
|
||||||
context.update(extra_context or {})
|
context.update(extra_context or {})
|
||||||
|
|
|
@ -41,7 +41,6 @@ class AdminSite(object):
|
||||||
|
|
||||||
def __init__(self, name=None, app_name='admin'):
|
def __init__(self, name=None, app_name='admin'):
|
||||||
self._registry = {} # model_class class -> admin_class instance
|
self._registry = {} # model_class class -> admin_class instance
|
||||||
self.root_path = None
|
|
||||||
if name is None:
|
if name is None:
|
||||||
self.name = 'admin'
|
self.name = 'admin'
|
||||||
else:
|
else:
|
||||||
|
@ -254,9 +253,6 @@ class AdminSite(object):
|
||||||
Handles the "change password" task -- both form display and validation.
|
Handles the "change password" task -- both form display and validation.
|
||||||
"""
|
"""
|
||||||
from django.contrib.auth.views import password_change
|
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 = {
|
defaults = {
|
||||||
'current_app': self.name,
|
'current_app': self.name,
|
||||||
|
@ -316,7 +312,6 @@ class AdminSite(object):
|
||||||
from django.contrib.auth.views import login
|
from django.contrib.auth.views import login
|
||||||
context = {
|
context = {
|
||||||
'title': _('Log in'),
|
'title': _('Log in'),
|
||||||
'root_path': self.root_path,
|
|
||||||
'app_path': request.get_full_path(),
|
'app_path': request.get_full_path(),
|
||||||
REDIRECT_FIELD_NAME: request.get_full_path(),
|
REDIRECT_FIELD_NAME: request.get_full_path(),
|
||||||
}
|
}
|
||||||
|
@ -373,7 +368,6 @@ class AdminSite(object):
|
||||||
context = {
|
context = {
|
||||||
'title': _('Site administration'),
|
'title': _('Site administration'),
|
||||||
'app_list': app_list,
|
'app_list': app_list,
|
||||||
'root_path': self.root_path,
|
|
||||||
}
|
}
|
||||||
context.update(extra_context or {})
|
context.update(extra_context or {})
|
||||||
return TemplateResponse(request, [
|
return TemplateResponse(request, [
|
||||||
|
@ -416,7 +410,6 @@ class AdminSite(object):
|
||||||
context = {
|
context = {
|
||||||
'title': _('%s administration') % capfirst(app_label),
|
'title': _('%s administration') % capfirst(app_label),
|
||||||
'app_list': [app_dict],
|
'app_list': [app_dict],
|
||||||
'root_path': self.root_path,
|
|
||||||
}
|
}
|
||||||
context.update(extra_context or {})
|
context.update(extra_context or {})
|
||||||
|
|
||||||
|
|
|
@ -32,19 +32,9 @@
|
||||||
{% if docsroot %}
|
{% if docsroot %}
|
||||||
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
|
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% url 'admin:password_change' as password_change_url %}
|
<a href="{% url 'admin:password_change' %}">
|
||||||
{% if password_change_url %}
|
|
||||||
<a href="{{ password_change_url }}">
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ root_path }}password_change/">
|
|
||||||
{% endif %}
|
|
||||||
{% trans 'Change password' %}</a> /
|
{% trans 'Change password' %}</a> /
|
||||||
{% url 'admin:logout' as logout_url %}
|
<a href="{% url 'admin:logout' %}">
|
||||||
{% if logout_url %}
|
|
||||||
<a href="{{ logout_url }}">
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ root_path }}logout/">
|
|
||||||
{% endif %}
|
|
||||||
{% trans 'Log out' %}</a>
|
{% trans 'Log out' %}</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -228,14 +228,10 @@ class RelatedFieldWidgetWrapper(forms.Widget):
|
||||||
def render(self, name, value, *args, **kwargs):
|
def render(self, name, value, *args, **kwargs):
|
||||||
rel_to = self.rel.to
|
rel_to = self.rel.to
|
||||||
info = (rel_to._meta.app_label, rel_to._meta.object_name.lower())
|
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
|
self.widget.choices = self.choices
|
||||||
output = [self.widget.render(name, value, *args, **kwargs)]
|
output = [self.widget.render(name, value, *args, **kwargs)]
|
||||||
if self.can_add_related:
|
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
|
# TODO: "id_" is hard-coded here. This should instead use the correct
|
||||||
# API to determine the ID dynamically.
|
# API to determine the ID dynamically.
|
||||||
output.append(u'<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
|
output.append(u'<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
|
||||||
|
|
|
@ -136,7 +136,6 @@ class UserAdmin(admin.ModelAdmin):
|
||||||
'original': user,
|
'original': user,
|
||||||
'save_as': False,
|
'save_as': False,
|
||||||
'show_save': True,
|
'show_save': True,
|
||||||
'root_path': self.admin_site.root_path,
|
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, [
|
return TemplateResponse(request, [
|
||||||
self.change_user_password_template or
|
self.change_user_password_template or
|
||||||
|
|
Loading…
Reference in New Issue