From 57e3f4143e408ad8b03f935fbb54e64b5e0aa7fd Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Wed, 2 Oct 2024 09:50:46 -0500 Subject: [PATCH] Fixes: #17566 - Fix issue `Job.get_absolute_url()` to prevent exception being thrown if no object_type is set --- netbox/core/models/jobs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/netbox/core/models/jobs.py b/netbox/core/models/jobs.py index 4a327a1d853..2b28bf3353d 100644 --- a/netbox/core/models/jobs.py +++ b/netbox/core/models/jobs.py @@ -118,10 +118,11 @@ def __str__(self): def get_absolute_url(self): # TODO: Employ dynamic registration - if self.object_type.model == 'reportmodule': - return reverse(f'extras:report_result', kwargs={'job_pk': self.pk}) - if self.object_type.model == 'scriptmodule': - return reverse(f'extras:script_result', kwargs={'job_pk': self.pk}) + if self.object_type: + if self.object_type.model == 'reportmodule': + return reverse(f'extras:report_result', kwargs={'job_pk': self.pk}) + if self.object_type.model == 'scriptmodule': + return reverse(f'extras:script_result', kwargs={'job_pk': self.pk}) return reverse('core:job', args=[self.pk]) def get_status_color(self):