diff --git a/netbox/extras/reports.py b/netbox/extras/reports.py index 284f69d77..9b12065ca 100644 --- a/netbox/extras/reports.py +++ b/netbox/extras/reports.py @@ -135,6 +135,13 @@ class Report(object): def source(self): return inspect.getsource(self.__class__) + @property + def is_valid(self): + """ + Indicates whether the report can be run. + """ + return bool(self.test_methods) + # # Logging methods # diff --git a/netbox/templates/extras/report.html b/netbox/templates/extras/report.html index 717c24eab..806279d20 100644 --- a/netbox/templates/extras/report.html +++ b/netbox/templates/extras/report.html @@ -8,15 +8,17 @@ {% if perms.extras.run_report %}
+ {% if not report.is_valid %} +
+ + {% trans "This report is invalid and cannot be run." %} +
+ {% endif %}
{% csrf_token %} {% render_form form %}
-