[PATCH v4 09/10] REST API: expose patch.checks
Andy Doan
andy.doan at linaro.org
Sat May 21 05:17:11 AEST 2016
Signed-off-by: Andy Doan <andy.doan at linaro.org>
---
patchwork/rest_serializers.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/patchwork/rest_serializers.py b/patchwork/rest_serializers.py
index 4fcd392..866cd86 100644
--- a/patchwork/rest_serializers.py
+++ b/patchwork/rest_serializers.py
@@ -66,6 +66,7 @@ class PatchSerializer(HyperlinkedModelSerializer):
list_serializer_class = PatchListSerializer
read_only_fields = ('project', 'name', 'date', 'submitter', 'diff',
'content', 'hash', 'msgid')
+ check_names = dict(Check.STATE_CHOICES)
mbox_url = SerializerMethodField()
state = SerializerMethodField()
@@ -79,6 +80,7 @@ class PatchSerializer(HyperlinkedModelSerializer):
def to_representation(self, instance):
data = super(PatchSerializer, self).to_representation(instance)
data['checks'] = data['url'] + 'checks/'
+ data['check'] = self.check_names[instance.combined_check_state]
headers = data.get('headers')
if headers:
data['headers'] = email.parser.Parser().parsestr(headers, True)
--
2.7.4
More information about the Patchwork
mailing list