File tree Expand file tree Collapse file tree 3 files changed +24
-13
lines changed
Expand file tree Collapse file tree 3 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -135,6 +135,13 @@ def filename(self):
135135 def source (self ):
136136 return inspect .getsource (self .__class__ )
137137
138+ @property
139+ def is_valid (self ):
140+ """
141+ Indicates whether the report can be run.
142+ """
143+ return bool (self .test_methods )
144+
138145 #
139146 # Logging methods
140147 #
Original file line number Diff line number Diff line change 88 {% if perms.extras.run_report %}
99 < div class ="row ">
1010 < div class ="col ">
11+ {% if not report.is_valid %}
12+ < div class ="alert alert-warning ">
13+ < i class ="mdi mdi-alert "> </ i >
14+ {% trans "This report is invalid and cannot be run." %}
15+ </ div >
16+ {% endif %}
1117 < form action ="{% url 'extras:report' module=report.module name=report.class_name %} " method ="post " class ="form-object-edit ">
1218 {% csrf_token %}
1319 {% render_form form %}
1420 < div class ="float-end ">
15- < button type ="submit " name ="_run " class ="btn btn-primary "
16- {% if not report.test_methods|length %}
17- disabled
18- {% endif %}
19- >
21+ < button type ="submit " name ="_run " class ="btn btn-primary "{% if not report.is_valid %} disabled{% endif %} >
2022 {% if report.result %}
2123 < i class ="mdi mdi-replay "> </ i > {% trans "Run Again" %}
2224 {% else %}
Original file line number Diff line number Diff line change @@ -68,16 +68,18 @@ <h5 class="card-header" id="module{{ module.pk }}">
6868 </ td >
6969 {% else %}
7070 < td class ="text-muted "> {% trans "Never" %}</ td >
71- {% if report.test_methods|length %}
72- < td > {{ ''|placeholder }}</ td >
73- {% else %}
74- < td >
75- Invalid (no test methods found)
76- </ td >
77- {% endif %}
71+ < td >
72+ {% if report.is_valid %}
73+ {{ ''|placeholder }}
74+ {% else %}
75+ < span class ="badge bg-danger " title ="{% trans "Report has no test methods " %}">
76+ {% trans "Invalid" %}
77+ </ span >
78+ {% endif %}
79+ </ td >
7880 {% endif %}
7981 < td >
80- {% if perms.extras.run_report and report.test_methods|length %}
82+ {% if perms.extras.run_report and report.is_valid %}
8183 < div class ="float-end noprint ">
8284 < form action ="{% url 'extras:report' module=report.module name=report.class_name %} " method ="post ">
8385 {% csrf_token %}
You can’t perform that action at this time.
0 commit comments