Skip to content

Commit

Permalink
Update task to serialize progress_report
Browse files Browse the repository at this point in the history
  • Loading branch information
werwty committed Aug 14, 2017
1 parent fc8f567 commit 5b66ba5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion platform/pulpcore/app/models/progress.py
Expand Up @@ -60,7 +60,7 @@ class ProgressReport(Model):
total = models.IntegerField(null=True)
done = models.IntegerField(default=0)

task = models.ForeignKey("Task", on_delete=models.CASCADE)
task = models.ForeignKey("Task", related_name='progress_reports', on_delete=models.CASCADE)
suffix = models.TextField(default='')

_using_context_manager = False
Expand Down
10 changes: 8 additions & 2 deletions platform/pulpcore/app/serializers/task.py
Expand Up @@ -3,7 +3,7 @@
from rest_framework import serializers

from pulpcore.app import models
from pulpcore.app.serializers import ModelSerializer
from pulpcore.app.serializers import ModelSerializer, ProgressReportSerializer


class TaskTagSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -73,11 +73,17 @@ class TaskSerializer(ModelSerializer):
read_only=True
)

progress_reports = ProgressReportSerializer(
many=True,
read_only=True
)

class Meta:
model = models.Task
fields = ModelSerializer.Meta.fields + ('group', 'state', 'started_at',
'finished_at', 'non_fatal_errors',
'error', 'worker', 'parent', 'tags')
'error', 'worker', 'parent', 'tags',
'progress_reports')


class WorkerSerializer(ModelSerializer):
Expand Down

0 comments on commit 5b66ba5

Please sign in to comment.