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 <[email protected]>

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 <[email protected]>

>  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?
_______________________________________________
Patchwork mailing list
[email protected]
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to