当前位置: 首页>>代码示例>>Python>>正文


Python actions.delete_selected方法代码示例

本文整理汇总了Python中django.contrib.admin.actions.delete_selected方法的典型用法代码示例。如果您正苦于以下问题:Python actions.delete_selected方法的具体用法?Python actions.delete_selected怎么用?Python actions.delete_selected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.contrib.admin.actions的用法示例。


在下文中一共展示了actions.delete_selected方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_actions

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def get_actions(self, request):
        actions = super().get_actions(request)

        def subadmin_delete_selected(modeladmin, req, qs):
            response = delete_selected(modeladmin, req, qs)
            if response:
                response.context_data.update(self.context_add_parent_data(request))
            return response

        if 'delete_selected' in actions:
            actions['delete_selected'] = (subadmin_delete_selected, 'delete_selected', actions['delete_selected'][2])

        return actions 
开发者ID:inueni,项目名称:django-subadmin,代码行数:15,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def __init__(self, name='admin'):
        self._registry = {}  # model_class class -> admin_class instance
        self.name = name
        self._actions = {'delete_selected': actions.delete_selected}
        self._global_actions = self._actions.copy() 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:7,代码来源:sites.py

示例3: __init__

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def __init__(self, name='admin'):
        self._registry = {}  # model_class class -> admin_class instance
        self.name = name
        self._actions = {'delete_selected': actions.delete_selected}
        self._global_actions = self._actions.copy()
        all_sites.add(self) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:8,代码来源:sites.py

示例4: __init__

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def __init__(self, django_site, name='admino'):
        self.django_site = django_site
        self._registry = {}
        self.name = name
        self._actions = {'delete_selected': actions.delete_selected}
        self._global_actions = self._actions.copy() 
开发者ID:erdem,项目名称:django-admino,代码行数:8,代码来源:sites.py

示例5: get_actions

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def get_actions(self, request):
        actions = super().get_actions(request)
        if 'delete_selected' in actions:
            del actions['delete_selected']
        return actions 
开发者ID:LexPredict,项目名称:lexpredict-contraxsuite,代码行数:7,代码来源:admin.py

示例6: delete_selected_action

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def delete_selected_action(self, model_admin, request, qs):
        objects = UsersTasksValidationAdmin.QSList(qs)
        if request.POST.get('post'):
            deletable_objects, model_count, perms_needed, protected = get_deleted_objects(
                objects, request, model_admin.admin_site)
            if not protected:
                res = delete_selected(model_admin, request, objects)
                for obj in objects:
                    self.on_object_deleted(obj)
                return res
        response = delete_selected(model_admin, request, objects)
        context = response.context_data
        context['running_tasks'] = self.get_user_task_names() or None
        return TemplateResponse(request, model_admin.delete_selected_confirmation_template, context) 
开发者ID:LexPredict,项目名称:lexpredict-contraxsuite,代码行数:16,代码来源:admin.py

示例7: delete_selected

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def delete_selected(self, request, queryset):
        if 'hard_delete' in dir(queryset):
            queryset.delete = queryset.hard_delete
        return delete_selected_(self, request, queryset) 
开发者ID:silverapp,项目名称:silver,代码行数:6,代码来源:admin.py

示例8: test_disable_action

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def test_disable_action(self):
        action_name = 'delete_selected'
        self.assertEqual(self.site._actions[action_name], delete_selected)
        self.site.disable_action(action_name)
        with self.assertRaises(KeyError):
            self.site._actions[action_name] 
开发者ID:nesdis,项目名称:djongo,代码行数:8,代码来源:test_adminsite.py

示例9: test_get_action

# 需要导入模块: from django.contrib.admin import actions [as 别名]
# 或者: from django.contrib.admin.actions import delete_selected [as 别名]
def test_get_action(self):
        """AdminSite.get_action() returns an action even if it's disabled."""
        action_name = 'delete_selected'
        self.assertEqual(self.site.get_action(action_name), delete_selected)
        self.site.disable_action(action_name)
        self.assertEqual(self.site.get_action(action_name), delete_selected) 
开发者ID:nesdis,项目名称:djongo,代码行数:8,代码来源:test_adminsite.py


注:本文中的django.contrib.admin.actions.delete_selected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。