1
1
import traceback
2
+ from collections import defaultdict
2
3
3
4
from django .contrib import messages
4
5
from django .contrib .contenttypes .models import ContentType
45
46
46
47
47
48
class DeviceComponentsView (generic .ObjectChildrenView ):
49
+ actions = ('add' , 'import' , 'export' , 'bulk_edit' , 'bulk_delete' , 'bulk_rename' , 'bulk_disconnect' )
50
+ action_perms = defaultdict (set , ** {
51
+ 'add' : {'add' },
52
+ 'import' : {'add' },
53
+ 'bulk_edit' : {'change' },
54
+ 'bulk_delete' : {'delete' },
55
+ 'bulk_rename' : {'change' },
56
+ 'bulk_disconnect' : {'change' },
57
+ })
48
58
queryset = Device .objects .all ()
49
59
50
60
def get_children (self , request , parent ):
@@ -1997,6 +2007,7 @@ class DeviceModuleBaysView(DeviceComponentsView):
1997
2007
table = tables .DeviceModuleBayTable
1998
2008
filterset = filtersets .ModuleBayFilterSet
1999
2009
template_name = 'dcim/device/modulebays.html'
2010
+ actions = ('add' , 'import' , 'export' , 'bulk_edit' , 'bulk_delete' , 'bulk_rename' )
2000
2011
tab = ViewTab (
2001
2012
label = _ ('Module Bays' ),
2002
2013
badge = lambda obj : obj .modulebays .count (),
@@ -2012,6 +2023,7 @@ class DeviceDeviceBaysView(DeviceComponentsView):
2012
2023
table = tables .DeviceDeviceBayTable
2013
2024
filterset = filtersets .DeviceBayFilterSet
2014
2025
template_name = 'dcim/device/devicebays.html'
2026
+ actions = ('add' , 'import' , 'export' , 'bulk_edit' , 'bulk_delete' , 'bulk_rename' )
2015
2027
tab = ViewTab (
2016
2028
label = _ ('Device Bays' ),
2017
2029
badge = lambda obj : obj .devicebays .count (),
@@ -2023,6 +2035,7 @@ class DeviceDeviceBaysView(DeviceComponentsView):
2023
2035
2024
2036
@register_model_view (Device , 'inventory' )
2025
2037
class DeviceInventoryView (DeviceComponentsView ):
2038
+ actions = ('add' , 'import' , 'export' , 'bulk_edit' , 'bulk_delete' , 'bulk_rename' )
2026
2039
child_model = InventoryItem
2027
2040
table = tables .DeviceInventoryItemTable
2028
2041
filterset = filtersets .InventoryItemFilterSet
0 commit comments