Adding asdot notation to ASN views

Adds custom property to asn model to compute asdot notation if required.
Updates asn view to show asdot notation if one exists in the format xxxxx (yyy.yyy)
Adds a custom column renderer to asn table to display asdot notation if one exists
This commit is contained in:
Jason Yates
2022-01-12 14:06:22 +00:00
parent be8fef0228
commit ea644868a6
3 changed files with 16 additions and 1 deletions

View File

@@ -106,6 +106,13 @@ class ASNTable(BaseTable):
asn = tables.Column(
linkify=True
)
def render_asn(self, value, record):
if record.asdot_notation:
return f'{value} ({record.asdot_notation})'
else:
return value
site_count = LinkedCountColumn(
viewname='dcim:site_list',
url_params={'asn_id': 'pk'},