Rename ActionsColumn sequence to actions

This commit is contained in:
jeremystretch 2022-03-14 13:45:21 -04:00
parent 245cff887c
commit 6170138124
8 changed files with 22 additions and 21 deletions

View File

@ -788,7 +788,6 @@ class DeviceInventoryItemTable(InventoryItemTable):
order_by=Accessor('_name'), order_by=Accessor('_name'),
attrs={'td': {'class': 'text-nowrap'}} attrs={'td': {'class': 'text-nowrap'}}
) )
actions = columns.ActionsColumn()
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):
model = InventoryItem model = InventoryItem

View File

@ -110,7 +110,7 @@ class ComponentTemplateTable(NetBoxTable):
class ConsolePortTemplateTable(ComponentTemplateTable): class ConsolePortTemplateTable(ComponentTemplateTable):
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
) )
@ -122,7 +122,7 @@ class ConsolePortTemplateTable(ComponentTemplateTable):
class ConsoleServerPortTemplateTable(ComponentTemplateTable): class ConsoleServerPortTemplateTable(ComponentTemplateTable):
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
) )
@ -134,7 +134,7 @@ class ConsoleServerPortTemplateTable(ComponentTemplateTable):
class PowerPortTemplateTable(ComponentTemplateTable): class PowerPortTemplateTable(ComponentTemplateTable):
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
) )
@ -146,7 +146,7 @@ class PowerPortTemplateTable(ComponentTemplateTable):
class PowerOutletTemplateTable(ComponentTemplateTable): class PowerOutletTemplateTable(ComponentTemplateTable):
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
) )
@ -161,7 +161,7 @@ class InterfaceTemplateTable(ComponentTemplateTable):
verbose_name='Management Only' verbose_name='Management Only'
) )
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
) )
@ -177,7 +177,7 @@ class FrontPortTemplateTable(ComponentTemplateTable):
) )
color = columns.ColorColumn() color = columns.ColorColumn()
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
) )
@ -190,7 +190,7 @@ class FrontPortTemplateTable(ComponentTemplateTable):
class RearPortTemplateTable(ComponentTemplateTable): class RearPortTemplateTable(ComponentTemplateTable):
color = columns.ColorColumn() color = columns.ColorColumn()
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
) )
@ -202,7 +202,7 @@ class RearPortTemplateTable(ComponentTemplateTable):
class ModuleBayTemplateTable(ComponentTemplateTable): class ModuleBayTemplateTable(ComponentTemplateTable):
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete') actions=('edit', 'delete')
) )
class Meta(ComponentTemplateTable.Meta): class Meta(ComponentTemplateTable.Meta):
@ -213,7 +213,7 @@ class ModuleBayTemplateTable(ComponentTemplateTable):
class DeviceBayTemplateTable(ComponentTemplateTable): class DeviceBayTemplateTable(ComponentTemplateTable):
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete') actions=('edit', 'delete')
) )
class Meta(ComponentTemplateTable.Meta): class Meta(ComponentTemplateTable.Meta):
@ -224,7 +224,7 @@ class DeviceBayTemplateTable(ComponentTemplateTable):
class InventoryItemTemplateTable(ComponentTemplateTable): class InventoryItemTemplateTable(ComponentTemplateTable):
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete') actions=('edit', 'delete')
) )
role = tables.Column( role = tables.Column(
linkify=True linkify=True

View File

@ -195,7 +195,9 @@ class ObjectChangeTable(NetBoxTable):
template_code=OBJECTCHANGE_REQUEST_ID, template_code=OBJECTCHANGE_REQUEST_ID,
verbose_name='Request ID' verbose_name='Request ID'
) )
actions = columns.ActionsColumn(sequence=()) actions = columns.ActionsColumn(
actions=()
)
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):
model = ObjectChange model = ObjectChange

View File

@ -57,7 +57,7 @@ class FHRPGroupAssignmentTable(NetBoxTable):
linkify=True linkify=True
) )
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete') actions=('edit', 'delete')
) )
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):

View File

@ -151,7 +151,7 @@ class VLANDevicesTable(VLANMembersTable):
linkify=True linkify=True
) )
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit',) actions=('edit',)
) )
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):
@ -165,7 +165,7 @@ class VLANVirtualMachinesTable(VLANMembersTable):
linkify=True linkify=True
) )
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit',) actions=('edit',)
) )
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):

View File

@ -6,7 +6,7 @@ from django.conf import settings
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from django.db.models import DateField, DateTimeField from django.db.models import DateField, DateTimeField
from django.template import Context, Template from django.template import Context, Template
from django.urls import reverse from django.urls import NoReverseMatch, reverse
from django.utils.formats import date_format from django.utils.formats import date_format
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django_tables2.columns import library from django_tables2.columns import library
@ -144,7 +144,7 @@ class ActionsColumn(tables.Column):
A dropdown menu which provides edit, delete, and changelog links for an object. Can optionally include A dropdown menu which provides edit, delete, and changelog links for an object. Can optionally include
additional buttons rendered from a template string. additional buttons rendered from a template string.
:param sequence: The ordered list of dropdown menu items to include :param actions: The ordered list of dropdown menu items to include
:param extra_buttons: A Django template string which renders additional buttons preceding the actions dropdown :param extra_buttons: A Django template string which renders additional buttons preceding the actions dropdown
""" """
attrs = {'td': {'class': 'text-end text-nowrap noprint'}} attrs = {'td': {'class': 'text-end text-nowrap noprint'}}
@ -155,14 +155,14 @@ class ActionsColumn(tables.Column):
'changelog': ActionsItem('Changelog', 'history'), 'changelog': ActionsItem('Changelog', 'history'),
} }
def __init__(self, *args, sequence=('edit', 'delete', 'changelog'), extra_buttons='', **kwargs): def __init__(self, *args, actions=('edit', 'delete', 'changelog'), extra_buttons='', **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.extra_buttons = extra_buttons self.extra_buttons = extra_buttons
# Determine which actions to enable # Determine which actions to enable
self.actions = { self.actions = {
name: self.actions[name] for name in sequence name: self.actions[name] for name in actions
} }
def header(self): def header(self):

View File

@ -86,7 +86,7 @@ class ContactAssignmentTable(NetBoxTable):
linkify=True linkify=True
) )
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete') actions=('edit', 'delete')
) )
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):

View File

@ -99,7 +99,7 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable):
linkify=True linkify=True
) )
actions = columns.ActionsColumn( actions = columns.ActionsColumn(
sequence=('edit', 'delete'), actions=('edit', 'delete'),
extra_buttons=VMINTERFACE_BUTTONS extra_buttons=VMINTERFACE_BUTTONS
) )