Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed dead compatibility code for removed AdminSite.root() method f…

…or mounting admin urls.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14412 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 21d6fb6062efa0c81b7e951cf6605bf98a2acd96 1 parent 5c05233
@carljm carljm authored
Showing with 4 additions and 18 deletions.
  1. +1 −1  django/contrib/admin/actions.py
  2. +3 −17 django/contrib/admin/util.py
View
2  django/contrib/admin/actions.py
@@ -29,7 +29,7 @@ def delete_selected(modeladmin, request, queryset):
# Populate deletable_objects, a data structure of all related objects that
# will also be deleted.
- deletable_objects, perms_needed = get_deleted_objects(queryset, opts, request.user, modeladmin.admin_site, levels_to_root=2)
+ deletable_objects, perms_needed = get_deleted_objects(queryset, opts, request.user, modeladmin.admin_site)
# The user has already confirmed the deletion.
# Do the deletion and return a None to display the change list view again.
View
20 django/contrib/admin/util.py
@@ -58,21 +58,15 @@ def flatten_fieldsets(fieldsets):
field_names.append(field)
return field_names
-def _format_callback(obj, user, admin_site, levels_to_root, perms_needed):
+def _format_callback(obj, user, admin_site, perms_needed):
has_admin = obj.__class__ in admin_site._registry
opts = obj._meta
- try:
+ if has_admin:
admin_url = reverse('%s:%s_%s_change'
% (admin_site.name,
opts.app_label,
opts.object_name.lower()),
None, (quote(obj._get_pk_val()),))
- except NoReverseMatch:
- admin_url = '%s%s/%s/%s/' % ('../'*levels_to_root,
- opts.app_label,
- opts.object_name.lower(),
- quote(obj._get_pk_val()))
- if has_admin:
p = '%s.%s' % (opts.app_label,
opts.get_delete_permission())
if not user.has_perm(p):
@@ -88,7 +82,7 @@ def _format_callback(obj, user, admin_site, levels_to_root, perms_needed):
return u'%s: %s' % (capfirst(opts.verbose_name),
force_unicode(obj))
-def get_deleted_objects(objs, opts, user, admin_site, levels_to_root=4):
+def get_deleted_objects(objs, opts, user, admin_site):
"""
Find all objects related to ``objs`` that should also be
deleted. ``objs`` should be an iterable of objects.
@@ -96,13 +90,6 @@ def get_deleted_objects(objs, opts, user, admin_site, levels_to_root=4):
Returns a nested list of strings suitable for display in the
template with the ``unordered_list`` filter.
- `levels_to_root` defines the number of directories (../) to reach
- the admin root path. In a change_view this is 4, in a change_list
- view 2.
-
- This is for backwards compatibility since the options.delete_selected
- method uses this function also from a change_list view.
- This will not be used if we can reverse the URL.
"""
collector = NestedObjects()
for obj in objs:
@@ -114,7 +101,6 @@ def get_deleted_objects(objs, opts, user, admin_site, levels_to_root=4):
to_delete = collector.nested(_format_callback,
user=user,
admin_site=admin_site,
- levels_to_root=levels_to_root,
perms_needed=perms_needed)
return to_delete, perms_needed
Please sign in to comment.
Something went wrong with that request. Please try again.