1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#8293: Tweak table column output & add changelog

This commit is contained in:
jeremystretch
2022-01-13 15:10:06 -05:00
parent aa77f8f0d2
commit 0ca6d73614
3 changed files with 14 additions and 4 deletions

View File

@@ -130,9 +130,20 @@ class ASN(PrimaryModel):
def get_absolute_url(self):
return reverse('ipam:asn', args=[self.pk])
@property
def asn_asdot(self):
"""
Return ASDOT notation for AS numbers greater than 16 bits.
"""
if self.asn > 65535:
return f'{self.asn // 65536}.{self.asn % 65536}'
return self.asn
@property
def asn_with_asdot(self):
# Return asn with asdot notation for an ASN larger than 65535 otherwise return the plain ASN
"""
Return both plain and ASDOT notation, where applicable.
"""
if self.asn > 65535:
return f'{self.asn} ({self.asn // 65536}.{self.asn % 65536})'
else: