From b4bc12a3ea148b5a04441c29d38da8bae1e13461 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sun, 11 Mar 2018 10:06:09 -0400 Subject: [PATCH] Updated foreignkeys --- app/models/project.py | 4 ++-- app/models/task.py | 2 +- nodeodm/models.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/project.py b/app/models/project.py index a8b1ab18..800dcbdb 100644 --- a/app/models/project.py +++ b/app/models/project.py @@ -68,8 +68,8 @@ def project_post_save(sender, instance, created, **kwargs): class ProjectUserObjectPermission(UserObjectPermissionBase): - content_object = models.ForeignKey(Project) + content_object = models.ForeignKey(Project, on_delete=models.CASCADE) class ProjectGroupObjectPermission(GroupObjectPermissionBase): - content_object = models.ForeignKey(Project) + content_object = models.ForeignKey(Project, on_delete=models.CASCADE) diff --git a/app/models/task.py b/app/models/task.py index aace4569..942aef78 100644 --- a/app/models/task.py +++ b/app/models/task.py @@ -147,7 +147,7 @@ class Task(models.Model): name = models.CharField(max_length=255, null=True, blank=True, help_text="A label for the task") processing_lock = models.BooleanField(default=False, help_text="A flag indicating whether this task is currently locked for processing. When this flag is turned on, the task is in the middle of a processing step.") processing_time = models.IntegerField(default=-1, help_text="Number of milliseconds that elapsed since the beginning of this task (-1 indicates that no information is available)") - processing_node = models.ForeignKey(ProcessingNode, null=True, blank=True, help_text="Processing node assigned to this task (or null if this task has not been associated yet)") + processing_node = models.ForeignKey(ProcessingNode, on_delete=models.SET_NULL, null=True, blank=True, help_text="Processing node assigned to this task (or null if this task has not been associated yet)") auto_processing_node = models.BooleanField(default=True, help_text="A flag indicating whether this task should be automatically assigned a processing node") status = models.IntegerField(choices=STATUS_CODES, db_index=True, null=True, blank=True, help_text="Current status of the task") last_error = models.TextField(null=True, blank=True, help_text="The last processing error received") diff --git a/nodeodm/models.py b/nodeodm/models.py index 1bfd89ff..f44bab05 100644 --- a/nodeodm/models.py +++ b/nodeodm/models.py @@ -215,8 +215,8 @@ def auto_update_node_info(sender, instance, created, **kwargs): pass class ProcessingNodeUserObjectPermission(UserObjectPermissionBase): - content_object = models.ForeignKey(ProcessingNode) + content_object = models.ForeignKey(ProcessingNode, on_delete=models.CASCADE) class ProcessingNodeGroupObjectPermission(GroupObjectPermissionBase): - content_object = models.ForeignKey(ProcessingNode) + content_object = models.ForeignKey(ProcessingNode, on_delete=models.CASCADE)