Skip to content

Commit

Permalink
Fixes: #17566 - Fix issue Job.get_absolute_url() to prevent excepti…
Browse files Browse the repository at this point in the history
…on being thrown if no object_type is set
  • Loading branch information
DanSheps committed Oct 2, 2024
1 parent 6ea0c0c commit 57e3f41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions netbox/core/models/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 57e3f41

Please sign in to comment.