Label the job detail panel attribute "Execution Time"

Renaming the attribute to elapsed_time changed its auto-derived label to
"Elapsed time", disagreeing with the list column, the filter form, the API
field and the model docs. The derived label is also built at runtime before
being passed to gettext, so it would never have been extracted into the
message catalog. An explicit label addresses both.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Jeremy Stretch 2026-08-05 17:10:38 -04:00
parent f427e61063
commit 26b5eb8a83
2 changed files with 9 additions and 2 deletions

View File

@ -167,7 +167,10 @@ class JobTestCase(
completed.save()
response = self.client.get(completed.get_absolute_url())
self.assertHttpStatus(response, 200)
self.assertIn('1m 30s', str(response.content))
content = str(response.content)
self.assertIn('1m 30s', content)
# The panel must use the same label as the list column, filter form, and API field
self.assertIn('Execution Time', content)
running = Job.objects.get(name='Job 2')
running.started = now - timedelta(hours=2)

View File

@ -62,7 +62,11 @@ class JobSchedulingPanel(panels.ObjectAttributesPanel):
scheduled = attrs.TemplatedAttr('scheduled', template_name='core/job/attrs/scheduled.html')
started = attrs.DateTimeAttr('started')
completed = attrs.DateTimeAttr('completed')
elapsed_time = attrs.TemplatedAttr('elapsed_time', template_name='core/job/attrs/elapsed_time.html')
elapsed_time = attrs.TemplatedAttr(
'elapsed_time',
label=_('Execution Time'),
template_name='core/job/attrs/elapsed_time.html',
)
queue = attrs.TextAttr('queue_name', label=_('Queue'))