mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
import django_tables2 as tables
|
|
|
|
from utilities.tables import BaseTable, ButtonsColumn, LinkedCountColumn, TagColumn, ToggleColumn
|
|
from .models import SecretRole, Secret
|
|
|
|
|
|
#
|
|
# Secret roles
|
|
#
|
|
|
|
class SecretRoleTable(BaseTable):
|
|
pk = ToggleColumn()
|
|
name = tables.LinkColumn()
|
|
secret_count = LinkedCountColumn(
|
|
viewname='secrets:secret_list',
|
|
url_params={'role': 'slug'},
|
|
verbose_name='Secrets'
|
|
)
|
|
actions = ButtonsColumn(SecretRole, pk_field='slug')
|
|
|
|
class Meta(BaseTable.Meta):
|
|
model = SecretRole
|
|
fields = ('pk', 'name', 'secret_count', 'description', 'slug', 'actions')
|
|
default_columns = ('pk', 'name', 'secret_count', 'description', 'actions')
|
|
|
|
|
|
#
|
|
# Secrets
|
|
#
|
|
|
|
class SecretTable(BaseTable):
|
|
pk = ToggleColumn()
|
|
assigned_object = tables.Column(
|
|
linkify=True,
|
|
verbose_name='Assigned object'
|
|
)
|
|
tags = TagColumn(
|
|
url_name='secrets:secret_list'
|
|
)
|
|
|
|
class Meta(BaseTable.Meta):
|
|
model = Secret
|
|
fields = ('pk', 'assigned_object', 'role', 'name', 'last_updated', 'hash', 'tags')
|
|
default_columns = ('pk', 'assigned_object', 'role', 'name', 'last_updated')
|