Add the label to the string representation

This commit is contained in:
Jonathan Senecal 2020-06-04 17:11:27 -04:00
parent b561c0bb76
commit 4c310e89e1
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):