[PATCH v5 05/10] REST: Add Users to the API

Finucane, Stephen stephen.finucane at intel.com
Thu Jun 2 23:12:09 AEST 2016


On 26 May 20:12, Andy Doan wrote:
> This exports user objects via the REST API.
> 
> Security Constraints:
>  * The API is read-only to authenticated users
> 
> Signed-off-by: Andy Doan <andy.doan at linaro.org>

Pretty sure I sent this reply already, but I don't see it in my sent
folder...

I'm OK with this, though there is some dead code and I'd like to rename
a field. If you're OK with this, I can do at merge time.

Reviewed-by: Stephen Finucane <stephen.finucane at intel.com>

>  class PersonSerializer(HyperlinkedModelSerializer):
>      class Meta:
>          model = Person
> -        exclude = ('user',)

Can we use 'user_url' instead of 'user'? It's a URL, rather than a
nested user object, so this makes more sense semantically speaking,
IMO.

>      def to_representation(self, instance):
>          data = super(PersonSerializer, self).to_representation(instance)
> -        data['username'] = instance.user.username if instance.user else ''
>          return data

This method no longer does anything and can be removed. In fact, it
shouldn't be added in the previous revision, I guess?


More information about the Patchwork mailing list