Fixes: #17566 - Fix issue Job.get_absolute_url() to prevent exception being thrown if no object_type is set (#17661)

* Fixes: #17566 - Fix issue `Job.get_absolute_url()` to prevent exception being thrown if no object_type is set

* Add back whitespace after statements

* Remove whitespace.  Change to if statement
This commit is contained in:
Daniel Sheppard 2024-10-07 07:35:47 -05:00 committed by GitHub
parent 66d792e0d8
commit 4b6e8a9e75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -118,9 +118,10 @@ class Job(models.Model):
def get_absolute_url(self):
# TODO: Employ dynamic registration
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':
elif self.object_type.model == 'scriptmodule':
return reverse(f'extras:script_result', kwargs={'job_pk': self.pk})
return reverse('core:job', args=[self.pk])