]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
REST API: expose patch.checks
authorAndy Doan <andy.doan@linaro.org>
Thu, 16 Jun 2016 21:13:24 +0000 (16:13 -0500)
committerStephen Finucane <stephen.finucane@intel.com>
Mon, 27 Jun 2016 17:20:37 +0000 (18:20 +0100)
Signed-off-by: Andy Doan <andy.doan@linaro.org>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/rest_serializers.py

index 688d8af5107dde61d5d8762b0c38d12c409338af..90fc16789779ed28091f477c274969b9c193e084 100644 (file)
@@ -85,6 +85,7 @@ class PatchSerializer(URLSerializer):
         # there's no need to expose an entire "tags" endpoint, so we custom
         # render this field
         exclude = ('tags',)
+    check_names = dict(Check.STATE_CHOICES)
     mbox_url = SerializerMethodField()
     state = SerializerMethodField()
 
@@ -98,6 +99,7 @@ class PatchSerializer(URLSerializer):
     def to_representation(self, instance):
         data = super(PatchSerializer, self).to_representation(instance)
         data['checks_url'] = data['url'] + 'checks/'
+        data['check'] = self.check_names[instance.combined_check_state]
         headers = data.get('headers')
         if headers is not None:
             data['headers'] = email.parser.Parser().parsestr(headers, True)