Coverage for core/tables/config.py: 100%
12 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
1from django.utils.translation import gettext_lazy as _
3from core.models import ConfigRevision
4from netbox.tables import NetBoxTable, columns
6__all__ = (
7 'ConfigRevisionTable',
8)
10REVISION_BUTTONS = """
11{% if not record.is_active %}
12<a href="{% url 'core:configrevision_restore' pk=record.pk %}" class="btn btn-sm btn-primary" title="Restore config">
13 <i class="mdi mdi-file-restore"></i>
14</a>
15{% endif %}
16"""
19class ConfigRevisionTable(NetBoxTable):
20 is_active = columns.BooleanColumn(
21 verbose_name=_('Is Active'),
22 accessor='active',
23 false_mark=None
24 )
25 actions = columns.ActionsColumn(
26 actions=('delete',),
27 extra_buttons=REVISION_BUTTONS
28 )
30 class Meta(NetBoxTable.Meta):
31 model = ConfigRevision
32 fields = (
33 'pk', 'id', 'is_active', 'created', 'comment',
34 )
35 default_columns = ('pk', 'id', 'is_active', 'created', 'comment')