mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-02 05:46:25 -06:00
Clean up DistanceColumn
This commit is contained in:
parent
2827374346
commit
ecdb3834ce
@ -694,20 +694,14 @@ class ChoicesColumn(tables.Column):
|
|||||||
return ', '.join(value)
|
return ', '.join(value)
|
||||||
|
|
||||||
|
|
||||||
class DistanceColumn(tables.TemplateColumn):
|
class DistanceColumn(TemplateColumn):
|
||||||
"""
|
"""
|
||||||
Distance with template code for formatting
|
Distance with template code for formatting
|
||||||
"""
|
"""
|
||||||
template_code = """
|
template_code = """
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% if record.distance %}{{ record.distance|floatformat:"-2" }} {{ record.distance_unit }}{% endif %}
|
{% if record.distance %}{{ record.distance|floatformat:"-2" }} {{ record.distance_unit }}{% endif %}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, template_code=template_code, order_by='_abs_distance', **kwargs):
|
||||||
super().__init__(
|
super().__init__(template_code=template_code, order_by=order_by, **kwargs)
|
||||||
template_code=self.template_code,
|
|
||||||
order_by=('_abs_distance'),
|
|
||||||
*args, **kwargs)
|
|
||||||
|
|
||||||
def value(self, value):
|
|
||||||
return value
|
|
||||||
|
Loading…
Reference in New Issue
Block a user