diff --git a/netbox/circuits/tables.py b/netbox/circuits/tables.py
index 4aca8688f..782b02394 100644
--- a/netbox/circuits/tables.py
+++ b/netbox/circuits/tables.py
@@ -2,13 +2,9 @@ import django_tables2 as tables
from django_tables2.utils import Accessor
from tenancy.tables import COL_TENANT
-from utilities.tables import BaseTable, ButtonsColumn, TagColumn, ToggleColumn
+from utilities.tables import BaseTable, ButtonsColumn, ChoiceFieldColumn, TagColumn, ToggleColumn
from .models import Circuit, CircuitType, Provider
-STATUS_LABEL = """
-{{ record.get_status_display }}
-"""
-
#
# Providers
@@ -64,9 +60,7 @@ class CircuitTable(BaseTable):
viewname='circuits:provider',
args=[Accessor('provider__slug')]
)
- status = tables.TemplateColumn(
- template_code=STATUS_LABEL
- )
+ status = ChoiceFieldColumn()
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py
index 371eff9db..4486ecd1b 100644
--- a/netbox/dcim/tables.py
+++ b/netbox/dcim/tables.py
@@ -3,7 +3,8 @@ from django_tables2.utils import Accessor
from tenancy.tables import COL_TENANT
from utilities.tables import (
- BaseTable, BooleanColumn, ButtonsColumn, ColorColumn, ColoredLabelColumn, TagColumn, ToggleColumn,
+ BaseTable, BooleanColumn, ButtonsColumn, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, TagColumn,
+ ToggleColumn,
)
from .models import (
Cable, ConsolePort, ConsolePortTemplate, ConsoleServerPort, ConsoleServerPortTemplate, Device, DeviceBay,
@@ -99,14 +100,6 @@ PLATFORM_VM_COUNT = """
{{ value|default:0 }}
"""
-STATUS_LABEL = """
-{{ record.get_status_display }}
-"""
-
-TYPE_LABEL = """
-{{ record.get_type_display }}
-"""
-
DEVICE_PRIMARY_IP = """
{{ record.primary_ip6.address.ip|default:"" }}
{% if record.primary_ip6 and record.primary_ip4 %}
{% endif %}
@@ -187,9 +180,7 @@ class SiteTable(BaseTable):
name = tables.LinkColumn(
order_by=('_name',)
)
- status = tables.TemplateColumn(
- template_code=STATUS_LABEL
- )
+ status = ChoiceFieldColumn()
region = tables.TemplateColumn(
template_code=SITE_REGION_LINK
)
@@ -272,9 +263,7 @@ class RackTable(BaseTable):
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
- status = tables.TemplateColumn(
- template_code=STATUS_LABEL
- )
+ status = ChoiceFieldColumn()
role = ColoredLabelColumn()
u_height = tables.TemplateColumn(
template_code="{{ record.u_height }}U",
@@ -595,9 +584,7 @@ class DeviceTable(BaseTable):
order_by=('_name',),
template_code=DEVICE_LINK
)
- status = tables.TemplateColumn(
- template_code=STATUS_LABEL
- )
+ status = ChoiceFieldColumn()
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
@@ -663,9 +650,7 @@ class DeviceImportTable(BaseTable):
name = tables.TemplateColumn(
template_code=DEVICE_LINK
)
- status = tables.TemplateColumn(
- template_code=STATUS_LABEL
- )
+ status = ChoiceFieldColumn()
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
@@ -876,9 +861,7 @@ class CableTable(BaseTable):
orderable=False,
verbose_name='Termination B'
)
- status = tables.TemplateColumn(
- template_code=STATUS_LABEL
- )
+ status = ChoiceFieldColumn()
length = tables.TemplateColumn(
template_code=CABLE_LENGTH,
order_by='_abs_length'
@@ -1062,12 +1045,8 @@ class PowerFeedTable(BaseTable):
rack = tables.Column(
linkify=True
)
- status = tables.TemplateColumn(
- template_code=STATUS_LABEL
- )
- type = tables.TemplateColumn(
- template_code=TYPE_LABEL
- )
+ status = ChoiceFieldColumn()
+ type = ChoiceFieldColumn()
max_utilization = tables.TemplateColumn(
template_code="{{ value }}%"
)
diff --git a/netbox/ipam/tables.py b/netbox/ipam/tables.py
index 6a76b5c91..e8b2474ea 100644
--- a/netbox/ipam/tables.py
+++ b/netbox/ipam/tables.py
@@ -1,12 +1,15 @@
import django_tables2 as tables
+from django.utils.safestring import mark_safe
from django_tables2.utils import Accessor
from dcim.models import Interface
from tenancy.tables import COL_TENANT
-from utilities.tables import BaseTable, BooleanColumn, ButtonsColumn, TagColumn, ToggleColumn
+from utilities.tables import BaseTable, BooleanColumn, ButtonsColumn, ChoiceFieldColumn, TagColumn, ToggleColumn
from virtualization.models import VMInterface
from .models import Aggregate, IPAddress, Prefix, RIR, Role, RouteTarget, Service, VLAN, VLANGroup, VRF
+AVAILABLE_LABEL = mark_safe('Available')
+
RIR_UTILIZATION = """