mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Refactor tables modules
This commit is contained in:
21
netbox/circuits/tables/columns.py
Normal file
21
netbox/circuits/tables/columns.py
Normal file
@ -0,0 +1,21 @@
|
||||
import django_tables2 as tables
|
||||
|
||||
__all__ = (
|
||||
'CommitRateColumn',
|
||||
)
|
||||
|
||||
|
||||
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
|
Reference in New Issue
Block a user