Coverage for dcim/object_actions.py: 94%

17 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-10 18:35 +0000

1from django.utils.translation import gettext_lazy as _ 

2 

3from netbox.object_actions import ObjectAction 

4 

5__all__ = ( 

6 'BulkAddComponents', 

7 'BulkDisconnect', 

8) 

9 

10 

11class BulkAddComponents(ObjectAction): 

12 """ 

13 Add components to the selected devices. 

14 """ 

15 label = _('Add Components') 

16 multi = True 

17 permissions_required = {'change'} 

18 template_name = 'dcim/buttons/bulk_add_components.html' 

19 

20 @classmethod 

21 def get_context(cls, context, obj): 

22 return { 

23 'formaction': context.get('formaction'), 

24 } 

25 

26 

27class BulkDisconnect(ObjectAction): 

28 """ 

29 Disconnect each of a set of objects to which a cable is connected. 

30 """ 

31 name = 'bulk_disconnect' 

32 label = _('Disconnect Selected') 

33 multi = True 

34 permissions_required = {'change'} 

35 template_name = 'dcim/buttons/bulk_disconnect.html'