1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

51 lines
1.3 KiB
Python
Raw Normal View History

2016-03-01 11:23:03 -05:00
import django_tables2 as tables
from utilities.tables import BaseTable, ButtonsColumn, LinkedCountColumn, TagColumn, ToggleColumn
2016-05-16 12:07:12 -04:00
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'},
2020-04-29 11:32:53 -04:00
verbose_name='Secrets'
)
actions = ButtonsColumn(SecretRole)
2016-05-16 12:07:12 -04:00
class Meta(BaseTable.Meta):
2016-05-16 12:07:12 -04:00
model = SecretRole
fields = ('pk', 'name', 'secret_count', 'description', 'slug', 'actions')
2020-04-29 11:32:53 -04:00
default_columns = ('pk', 'name', 'secret_count', 'description', 'actions')
2016-03-01 11:23:03 -05:00
#
# Secrets
#
class SecretTable(BaseTable):
pk = ToggleColumn()
id = tables.Column( # Provides a link to the secret
linkify=True
)
assigned_object = tables.Column(
linkify=True,
verbose_name='Assigned object'
)
role = tables.Column(
linkify=True
)
tags = TagColumn(
url_name='secrets:secret_list'
)
2016-03-01 11:23:03 -05:00
class Meta(BaseTable.Meta):
2016-03-01 11:23:03 -05:00
model = Secret
fields = ('pk', 'id', 'assigned_object', 'role', 'name', 'last_updated', 'hash', 'tags')
default_columns = ('pk', 'id', 'assigned_object', 'role', 'name', 'last_updated')