瀏覽代碼

Skip secondary check if get_absolute_url() not defined for model

Jeremy Stretch 5 年之前
父節點
當前提交
7f1d9aeaf8
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      netbox/utilities/testing/views.py

+ 1 - 1
netbox/utilities/testing/views.py

@@ -580,7 +580,7 @@ class ViewTestCases:
             if hasattr(self.model, 'name'):
                 self.assertIn(instance1.name, content)
                 self.assertNotIn(instance2.name, content)
-            else:
+            elif hasattr(self.model, 'get_absolute_url'):
                 self.assertIn(instance1.get_absolute_url(), content)
                 self.assertNotIn(instance2.get_absolute_url(), content)