(self, request, queryset)
逐一删除
逐一删除
逐一删除
def delete_selected_recusively(self, request, queryset):
        """逐一删除"""
        if not request.POST.get("post"):
            resp = delete_selected(self, request, queryset)
            resp.context_data.update(
                wechat_app=request.app,
                wechat_app_id=request.app_id
            )
            return resp

        with transaction.atomic():
            for o in queryset.all():
                try:
                    if not self.has_delete_permission(request, o):
                        raise PermissionDenied
                    o.delete()
                except WeChatClientException:
                    msg = _("delete %(category)s failed: %(obj)s") % dict(
                        category=self.model.verbose_name_plural,
                        obj=o
                    )
                    request.app.logger("admin").warning(msg, exc_info=True)
                    raise
def delete_selected_recusively ( self , request , queryset ) : if not request . POST . get ( "post" ) : resp = delete_selected ( self , request , queryset ) resp . context_data . update ( wechat_app = request . app , wechat_app_id = request . app_id ) return resp with transaction . atomic ( ) : for o in queryset . all ( ) : try : if not self . has_delete_permission ( request , o ) : raise PermissionDenied o . delete ( ) except WeChatClientException : msg = _ ( "delete %(category)s failed: %(obj)s" ) % dict ( category = self . model . verbose_name_plural , obj = o ) request . app . logger ( "admin" ) . warning ( msg , exc_info = True ) raise