simplify by using lambda function

This commit is contained in:
Antoine Keranflec'h 2025-03-10 16:12:21 +00:00
parent cc9fc693ff
commit 0f10b3a53b
2 changed files with 2 additions and 11 deletions

View File

@ -4,7 +4,7 @@ from django_tables2.utils import Accessor
from netbox.tables import NetBoxTable, columns
from tenancy.models import *
from utilities.tables import linkify_phone, linkify_url
from utilities.tables import linkify_phone
__all__ = (
'ContactAssignmentTable',
@ -127,7 +127,7 @@ class ContactAssignmentTable(NetBoxTable):
contact_link = tables.Column(
accessor=Accessor('contact__link'),
verbose_name=_('Contact Link'),
linkify=linkify_url,
linkify=lambda value: value,
)
contact_description = tables.Column(
accessor=Accessor('contact__description'),

View File

@ -32,15 +32,6 @@ def linkify_phone(value):
return f"tel:{value.replace(' ', '')}"
def linkify_url(value):
"""
Render a URL as a hyperlink.
"""
if value is None:
return None
return value
def register_table_column(column, name, *tables):
"""
Register a custom column for use on one or more tables.