From: Andy Doan Date: Thu, 16 Jun 2016 21:13:24 +0000 (-0500) Subject: REST API: expose patch.checks X-Git-Tag: v2.0.0-rc1~336 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcc343f2ba7786abd564e4db538e9b0c17e20e1a;p=thirdparty%2Fpatchwork.git REST API: expose patch.checks Signed-off-by: Andy Doan Reviewed-by: Stephen Finucane --- diff --git a/patchwork/rest_serializers.py b/patchwork/rest_serializers.py index 688d8af5..90fc1678 100644 --- a/patchwork/rest_serializers.py +++ b/patchwork/rest_serializers.py @@ -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)