diff --git a/netbox/extras/reports.py b/netbox/extras/reports.py index 6af81a9d95..284f69d777 100644 --- a/netbox/extras/reports.py +++ b/netbox/extras/reports.py @@ -106,8 +106,6 @@ def __init__(self): 'failure': 0, 'log': [], } - if not test_methods: - raise Exception("A report must contain at least one test method.") self.test_methods = test_methods @classproperty diff --git a/netbox/templates/extras/report_list.html b/netbox/templates/extras/report_list.html index 49353f9ccb..153f4d4011 100644 --- a/netbox/templates/extras/report_list.html +++ b/netbox/templates/extras/report_list.html @@ -68,10 +68,18 @@
{% else %} {% trans "Never" %} - {{ ''|placeholder }} + {% if report.test_methods|length %} + {{ ''|placeholder }} + {% else %} + + + A report must contain at least one test method. + + + {% endif %} {% endif %} - {% if perms.extras.run_report %} + {% if perms.extras.run_report and report.test_methods|length %}
{% csrf_token %}