From ba716f1a1b1f0725ee7458f2928103529800d4a7 Mon Sep 17 00:00:00 2001 From: Vermaas <vermaas@astron.nl> Date: Wed, 1 Mar 2023 08:52:27 +0100 Subject: [PATCH] task goes 'on hold' when status goes to 'stored' --- atdb/taskdatabase/models.py | 10 ++++++++++ atdb/taskdatabase/templates/taskdatabase/index.html | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/atdb/taskdatabase/models.py b/atdb/taskdatabase/models.py index deed3c94..f1b3bd95 100644 --- a/atdb/taskdatabase/models.py +++ b/atdb/taskdatabase/models.py @@ -105,6 +105,16 @@ class Task(models.Model): def __str__(self): return str(self.id) + ' - (' + self.task_type + ') - ' + str(self.sas_id) + def save(self, *args, **kwargs): + # nv:1mar2023, temporary hack, set tasks 'on hold' as soon they get to 'stored' + # (users forget to do that manually, causing unwanted ingests) + + if (self.status != 'stored') & (self.new_status == 'stored'): + self.resume = False + + super(Task, self).save(*args, **kwargs) + + # this translates a view-name (from urls.py) back to a url, to avoid hardcoded url's in the html templates # bad : <td><a href="/atdb/tasks/{{ task.id }}/" target="_blank">{{ task.taskID }} </a> </td> # good: <td><a href="{{ task.get_absolute_url }}" target="_blank">{{ task.taskID }} </a> </td> diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index eb4a14ef..28aae03a 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -34,7 +34,7 @@ {% include 'taskdatabase/pagination.html' %} </div> </div> - <p class="footer"> Version 27 Februari 2023 + <p class="footer"> Version 1 March 2023 </div> -- GitLab