Clean up DistanceColumn

This commit is contained in:
Jeremy Stretch 2024-10-10 10:00:22 -04:00
parent 2827374346
commit ecdb3834ce

View File

@ -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