Use result id instead of primary key for job identification.

parent b0df9666
......@@ -4,7 +4,7 @@ from .models import Job
class JobAdmin(admin.ModelAdmin):
list_display = ('name', 'result_id', 'created_on', 'finished_on')
list_display = ('name', 'result_id', 'status', 'created_on', 'finished_on')
list_filter = ('result', )
readonly_fields = ('name', 'task', 'result_id', 'result', 'status', 'created_on', 'finished_on')
......
......@@ -14,7 +14,7 @@ class Job(models.Model):
name = models.CharField(max_length=255, help_text="name of the job")
task = models.TextField(help_text="celery task signature in string form")
result_id = models.CharField(max_length=255, help_text="celery asyncresult ID for tracing task")
result_id = models.CharField(unique=True, max_length=255, help_text="celery asyncresult ID for tracing task")
status = models.CharField(max_length=255, help_text="status of the job")
result = JSONField(help_text="output of the task as JSON")
......
......@@ -160,7 +160,7 @@ class UrlAdmin(admin.ModelAdmin):
task = security_headers_scan_urls(urls=urls, execute=False)
name = "Scan Security Headers (%s) " % str(urls)
job = Job.create(task, name)
self.message_user(request, "%s: job created, id:%s" % (name, job.id))
self.message_user(request, "%s: job created, id:%s" % (name, str(job)))
security_headers.short_description = "Scan Security Headers"
actions.append('security_headers')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment