diff --git a/netbox/circuits/tables.py b/netbox/circuits/tables.py index 86a55eba5..29bf704f0 100644 --- a/netbox/circuits/tables.py +++ b/netbox/circuits/tables.py @@ -22,11 +22,32 @@ CIRCUITTERMINATION_LINK = """ {% endif %} """ +# +# Table columns +# + + +class CommitRateColumn(tables.TemplateColumn): + """ + Humanize the commit rate in the column view + """ + + template_code = """ + {% load helpers %} + {{ record.commit_rate|humanize_speed }} + """ + + def __init__(self, *args, **kwargs): + super().__init__(template_code=self.template_code, *args, **kwargs) + + def value(self, value): + return str(value) if value else None # # Providers # + class ProviderTable(BaseTable): pk = ToggleColumn() name = tables.Column( @@ -119,6 +140,7 @@ class CircuitTable(BaseTable): template_code=CIRCUITTERMINATION_LINK, verbose_name='Side Z' ) + commit_rate = CommitRateColumn() comments = MarkdownColumn() tags = TagColumn( url_name='circuits:circuit_list'