Added delete button to the single_report page to delete report from DB
Added a total count value to the list_reports page
PRODX-37495
Change-Id: Ifff4f61e1af7fcacfaa6dfcc105af9ba8126358a
diff --git a/testrail_bot/control/views.py b/testrail_bot/control/views.py
index c9fe8f3..42b87c0 100644
--- a/testrail_bot/control/views.py
+++ b/testrail_bot/control/views.py
@@ -66,6 +66,16 @@
"finished": report.finished})
+def delete_report(request, report_id):
+ report:models.TestRailReport = models.TestRailReport.objects.get(pk=report_id)
+ try:
+ os.remove(report.path.path)
+ except FileNotFoundError:
+ pass
+ report.delete()
+ return redirect("list_reports")
+
+
def submit_run(request, run_id):
run = models.TestRailTestRun.objects.get(pk=run_id)
is_testplan = test_rail_api.is_testplan(run.run_id)