Skip to content

Commit

Permalink
Add a suffix attribute to the ProgressReport model.
Browse files Browse the repository at this point in the history
  • Loading branch information
ipanova committed Dec 7, 2016
1 parent 50ce6ba commit fa6c005
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/pulp/app/models/progress.py
Expand Up @@ -27,6 +27,8 @@ class ProgressReport(Model):
total: (models.IntegerField) The total count of items to be handled by the ProgressBar
(required)
done (models.IntegerField): The count of items already processed. Defaults to 0.
suffix (models.TextField): Customizable suffix rendered with the progress report
See `docs https://github.com/verigak/progress>`_. for more info.
Relations:
Expand Down Expand Up @@ -54,6 +56,7 @@ class ProgressReport(Model):
done = models.IntegerField(default=0)

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

def save(self, *args, **kwargs):
"""
Expand Down
7 changes: 6 additions & 1 deletion app/pulp/app/serializers/progress.py
Expand Up @@ -30,6 +30,11 @@ class ProgressReportSerializer(ModelSerializer):
read_only=True
)

suffix = serializers.CharField(
help_text=_("The suffix to be shown with the progress report."),
read_only=True
)

task = serializers.HyperlinkedRelatedField(
help_text=_("The task associated with this progress report."),
read_only=True,
Expand All @@ -41,4 +46,4 @@ class Meta:
# this serializer is meant to be nested inside Task serializer,
# so it will not have its own endpoint, that's why
# we need to explicitly define fields to exclude '_href' field.
fields = ('message', 'state', 'total', 'done', 'task')
fields = ('message', 'state', 'total', 'done', 'suffix', 'task')

0 comments on commit fa6c005

Please sign in to comment.