Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Carl Meyer authored November 01, 2010
2  django/contrib/admin/actions.py
@@ -29,7 +29,7 @@ def delete_selected(modeladmin, request, queryset):
29 29
 
30 30
     # Populate deletable_objects, a data structure of all related objects that
31 31
     # will also be deleted.
32  
-    deletable_objects, perms_needed = get_deleted_objects(queryset, opts, request.user, modeladmin.admin_site, levels_to_root=2)
  32
+    deletable_objects, perms_needed = get_deleted_objects(queryset, opts, request.user, modeladmin.admin_site)
33 33
 
34 34
     # The user has already confirmed the deletion.
35 35
     # Do the deletion and return a None to display the change list view again.
20  django/contrib/admin/util.py
@@ -58,21 +58,15 @@ def flatten_fieldsets(fieldsets):
58 58
                 field_names.append(field)
59 59
     return field_names
60 60
 
61  
-def _format_callback(obj, user, admin_site, levels_to_root, perms_needed):
  61
+def _format_callback(obj, user, admin_site, perms_needed):
62 62
     has_admin = obj.__class__ in admin_site._registry
63 63
     opts = obj._meta
64  
-    try:
  64
+    if has_admin:
65 65
         admin_url = reverse('%s:%s_%s_change'
66 66
                             % (admin_site.name,
67 67
                                opts.app_label,
68 68
                                opts.object_name.lower()),
69 69
                             None, (quote(obj._get_pk_val()),))
70  
-    except NoReverseMatch:
71  
-        admin_url = '%s%s/%s/%s/' % ('../'*levels_to_root,
72  
-                                     opts.app_label,
73  
-                                     opts.object_name.lower(),
74  
-                                     quote(obj._get_pk_val()))
75  
-    if has_admin:
76 70
         p = '%s.%s' % (opts.app_label,
77 71
                        opts.get_delete_permission())
78 72
         if not user.has_perm(p):
@@ -88,7 +82,7 @@ def _format_callback(obj, user, admin_site, levels_to_root, perms_needed):
88 82
         return u'%s: %s' % (capfirst(opts.verbose_name),
89 83
                             force_unicode(obj))
90 84
 
91  
-def get_deleted_objects(objs, opts, user, admin_site, levels_to_root=4):
  85
+def get_deleted_objects(objs, opts, user, admin_site):
92 86
     """
93 87
     Find all objects related to ``objs`` that should also be
94 88
     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):
96 90
     Returns a nested list of strings suitable for display in the
97 91
     template with the ``unordered_list`` filter.
98 92
 
99  
-    `levels_to_root` defines the number of directories (../) to reach
100  
-    the admin root path. In a change_view this is 4, in a change_list
101  
-    view 2.
102  
-
103  
-    This is for backwards compatibility since the options.delete_selected
104  
-    method uses this function also from a change_list view.
105  
-    This will not be used if we can reverse the URL.
106 93
     """
107 94
     collector = NestedObjects()
108 95
     for obj in objs:
@@ -114,7 +101,6 @@ def get_deleted_objects(objs, opts, user, admin_site, levels_to_root=4):
114 101
     to_delete = collector.nested(_format_callback,
115 102
                                  user=user,
116 103
                                  admin_site=admin_site,
117  
-                                 levels_to_root=levels_to_root,
118 104
                                  perms_needed=perms_needed)
119 105
 
120 106
     return to_delete, perms_needed

0 notes on commit 21d6fb6

Please sign in to comment.
Something went wrong with that request. Please try again.