On 18 May 22:31, Andy Doan wrote: > The int value isn't very useful and the goal is to move this to an enum > over time. > > Signed-off-by: Andy Doan <[email protected]>
Reviewed-by: Stephen Finucane <[email protected]> One nit below. > @@ -61,10 +61,21 @@ class PatchSerializer(ModelSerializer): > 'content', 'hash', 'msgid') > mbox_url = SerializerMethodField() > > + def run_validation(self, data): > + state = data.get('state') > + if state: > + for st in State.objects.all(): > + if st.name == state: > + data['state'] = st.id > + break > + return super(PatchSerializer, self).run_validation(data) > + > def to_representation(self, instance): > request = self.context.get('request', None) > data = super(PatchSerializer, self).to_representation(instance) > > + data['state'] = instance.state.name > + nit: remove this whitespace > data['mbox_url'] = request.build_absolute_uri(data['mbox_url']) > data['project'] = request.build_absolute_uri( > reverse('api_1.0:project-detail', args=[data['project']])) _______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
