mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 00:28:16 -06:00
Use EmailColumn instead of linkify_email
This commit is contained in:
parent
1a0750a3e4
commit
58befa4442
@ -4,7 +4,7 @@ from django_tables2.utils import Accessor
|
|||||||
|
|
||||||
from netbox.tables import NetBoxTable, columns
|
from netbox.tables import NetBoxTable, columns
|
||||||
from tenancy.models import *
|
from tenancy.models import *
|
||||||
from utilities.tables import linkify_phone, linkify_email
|
from utilities.tables import linkify_phone
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'ContactAssignmentTable',
|
'ContactAssignmentTable',
|
||||||
@ -116,10 +116,9 @@ class ContactAssignmentTable(NetBoxTable):
|
|||||||
verbose_name=_('Contact Phone'),
|
verbose_name=_('Contact Phone'),
|
||||||
linkify=linkify_phone,
|
linkify=linkify_phone,
|
||||||
)
|
)
|
||||||
contact_email = tables.Column(
|
contact_email = tables.EmailColumn(
|
||||||
accessor=Accessor('contact__email'),
|
accessor=Accessor('contact__email'),
|
||||||
verbose_name=_('Contact Email'),
|
verbose_name=_('Contact Email'),
|
||||||
linkify=linkify_email,
|
|
||||||
)
|
)
|
||||||
contact_address = tables.Column(
|
contact_address = tables.Column(
|
||||||
accessor=Accessor('contact__address'),
|
accessor=Accessor('contact__address'),
|
||||||
|
@ -23,15 +23,6 @@ def get_table_ordering(request, table):
|
|||||||
return preference
|
return preference
|
||||||
|
|
||||||
|
|
||||||
def linkify_email(value):
|
|
||||||
"""
|
|
||||||
Render an email address as a hyperlink.
|
|
||||||
"""
|
|
||||||
if value is None:
|
|
||||||
return None
|
|
||||||
return f"mailto:{value.replace(' ', '')}"
|
|
||||||
|
|
||||||
|
|
||||||
def linkify_phone(value):
|
def linkify_phone(value):
|
||||||
"""
|
"""
|
||||||
Render a telephone number as a hyperlink.
|
Render a telephone number as a hyperlink.
|
||||||
|
Loading…
Reference in New Issue
Block a user