Add the label to the string representation

This commit is contained in:
Jonathan Senecal 2020-06-04 17:11:27 -04:00
parent e9f8640ee6
commit f8851121ab
2 changed files with 4 additions and 0 deletions

View File

@ -282,6 +282,8 @@ class InterfaceTemplate(ComponentTemplateModel):
unique_together = ('device_type', 'name')
def __str__(self):
if self.label:
return f"{self.name} ({self.label})"
return self.name
def instantiate(self, device):

View File

@ -691,6 +691,8 @@ class Interface(CableTermination, ComponentModel):
unique_together = ('device', 'name')
def __str__(self):
if self.label:
return f"{self.name} ({self.label})"
return self.name
def get_absolute_url(self):