mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
simplify by using lambda function
This commit is contained in:
parent
cc9fc693ff
commit
0f10b3a53b
@ -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'),
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user