diff --git a/django_mongoengine/mongo_admin/actions.py b/django_mongoengine/mongo_admin/actions.py index aa240d1..fcabc38 100644 --- a/django_mongoengine/mongo_admin/actions.py +++ b/django_mongoengine/mongo_admin/actions.py @@ -39,13 +39,11 @@ def _delete_selected(modeladmin, request, queryset): if not modeladmin.has_delete_permission(request): raise PermissionDenied - using = router.db_for_write(modeladmin.model) - # Populate deletable_objects, a data structure of all related objects that # will also be deleted. # TODO: Permissions would be so cool... deletable_objects, perms_needed, protected = get_deleted_objects( - queryset, opts, request.user, modeladmin.admin_site, using) + queryset, request, modeladmin.admin_site) # The user has already confirmed the deletion. # Do the deletion and return a None to display the change list view again. diff --git a/django_mongoengine/mongo_admin/options.py b/django_mongoengine/mongo_admin/options.py index cda6b42..4d8855e 100644 --- a/django_mongoengine/mongo_admin/options.py +++ b/django_mongoengine/mongo_admin/options.py @@ -396,19 +396,10 @@ def delete_view(self, request, object_id, extra_context=None): {'name': force_text(opts.verbose_name), 'key': escape(object_id)} ) - from django.db import router - using = router.db_for_write(self.model) - # Populate deleted_objects, a data structure of all related objects that # will also be deleted. - try: - # Django 2.x/3.x - (deleted_objects, model_count, perms_needed, protected) = get_deleted_objects( - [obj], request, self.admin_site) - except TypeError: - # Django 1.x - (deleted_objects, model_count, perms_needed, protected) = get_deleted_objects( - [obj], opts, request.user, self.admin_site, using) + (deleted_objects, model_count, perms_needed, protected) = get_deleted_objects( + [obj], request, self.admin_site) if request.POST: # The user has already confirmed the deletion. if perms_needed: