當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。