Просмотр исходного кода

Fix string repr for ContactAssignment

jeremystretch 4 лет назад
Родитель
Сommit
554b44b9f2
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      netbox/tenancy/models.py

+ 3 - 1
netbox/tenancy/models.py

@@ -262,4 +262,6 @@ class ContactAssignment(ChangeLoggedModel):
         unique_together = ('content_type', 'object_id', 'contact', 'role', 'priority')
         unique_together = ('content_type', 'object_id', 'contact', 'role', 'priority')
 
 
     def __str__(self):
     def __str__(self):
-        return f"{self.contact} ({self.get_priority_display()})" if self.priority else self.name
+        if self.priority:
+            return f"{self.contact} ({self.get_priority_display()})"
+        return str(self.contact)