[PATCH v3 09/10] REST API: expose patch.checks

Andy Doan andy.doan at linaro.org
Thu May 19 13:31:01 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 801978c..1ef6df1 100644
--- a/patchwork/rest_serializers.py
+++ b/patchwork/rest_serializers.py
@@ -60,6 +60,7 @@ class PatchSerializer(ModelSerializer):
         read_only_fields = ('project', 'name', 'date', 'submitter', 'diff',
                             'content', 'hash', 'msgid')
     mbox_url = SerializerMethodField()
+    check_names = dict(Check.STATE_CHOICES)
 
     def run_validation(self, data):
         state = data.get('state')
@@ -75,6 +76,7 @@ class PatchSerializer(ModelSerializer):
         data = super(PatchSerializer, self).to_representation(instance)
 
         data['state'] = instance.state.name
+        data['checks'] = self.check_names[instance.combined_check_state]
 
         data['mbox_url'] = request.build_absolute_uri(data['mbox_url'])
         data['project'] = request.build_absolute_uri(
-- 
2.7.4



More information about the Patchwork mailing list