[PATCH v2 10/13] REST: Add id field to all endpoints

Daniel Axtens dja at axtens.net
Mon Nov 21 15:02:46 AEDT 2016


Hi Stephen,

A tinsy bit of explanation in the commit message would be good, but
apart from that:

Reviewed-by: Daniel Axtens <dja at axtens.net>

Regards,
Daniel


> Signed-off-by: Stephen Finucane <stephen at that.guru>
> Cc: Andy Doan <andy.doan at linaro.org>
> ---
>  patchwork/api/check.py   | 2 +-
>  patchwork/api/patch.py   | 6 +++---
>  patchwork/api/person.py  | 2 +-
>  patchwork/api/project.py | 2 +-
>  patchwork/api/user.py    | 2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/patchwork/api/check.py b/patchwork/api/check.py
> index 1ff9992..43463fe 100644
> --- a/patchwork/api/check.py
> +++ b/patchwork/api/check.py
> @@ -77,7 +77,7 @@ class CheckSerializer(HyperlinkedModelSerializer):
>  
>      class Meta:
>          model = Check
> -        fields = ('url', 'patch', 'user', 'date', 'state', 'target_url',
> +        fields = ('id', 'url', 'patch', 'user', 'date', 'state', 'target_url',
>                    'context', 'description')
>          read_only_fields = ('date',)
>          extra_kwargs = {
> diff --git a/patchwork/api/patch.py b/patchwork/api/patch.py
> index 58fd843..e8b6c1c 100644
> --- a/patchwork/api/patch.py
> +++ b/patchwork/api/patch.py
> @@ -76,9 +76,9 @@ class PatchListSerializer(HyperlinkedModelSerializer):
>  
>      class Meta:
>          model = Patch
> -        fields = ('url', 'project', 'msgid', 'date', 'name', 'commit_ref',
> -                  'pull_url', 'state', 'archived', 'hash', 'submitter',
> -                  'delegate', 'mbox', 'check', 'checks', 'tags')
> +        fields = ('id', 'url', 'project', 'msgid', 'date', 'name',
> +                  'commit_ref', 'pull_url', 'state', 'archived', 'hash',
> +                  'submitter', 'delegate', 'mbox', 'check', 'checks', 'tags')
>          read_only_fields = ('project', 'msgid', 'date', 'name', 'hash',
>                              'submitter', 'mbox', 'mbox', 'series', 'check',
>                              'checks', 'tags')
> diff --git a/patchwork/api/person.py b/patchwork/api/person.py
> index c84cff5..2c1ca15 100644
> --- a/patchwork/api/person.py
> +++ b/patchwork/api/person.py
> @@ -28,7 +28,7 @@ from patchwork.models import Person
>  class PersonSerializer(HyperlinkedModelSerializer):
>      class Meta:
>          model = Person
> -        fields = ('url', 'name', 'email', 'user')
> +        fields = ('id', 'url', 'name', 'email', 'user')
>          read_only_fields = fields
>          extra_kwargs = {
>              'url': {'view_name': 'api-person-detail'},
> diff --git a/patchwork/api/project.py b/patchwork/api/project.py
> index 881de2d..dd6370d 100644
> --- a/patchwork/api/project.py
> +++ b/patchwork/api/project.py
> @@ -34,7 +34,7 @@ class ProjectSerializer(HyperlinkedModelSerializer):
>  
>      class Meta:
>          model = Project
> -        fields = ('url', 'name', 'link_name', 'list_id', 'list_email',
> +        fields = ('id', 'url', 'name', 'link_name', 'list_id', 'list_email',
>                    'web_url', 'scm_url', 'webscm_url')
>          extra_kwargs = {
>              'url': {'view_name': 'api-project-detail'},
> diff --git a/patchwork/api/user.py b/patchwork/api/user.py
> index c5f7c05..2153cc9 100644
> --- a/patchwork/api/user.py
> +++ b/patchwork/api/user.py
> @@ -37,7 +37,7 @@ class UserSerializer(HyperlinkedModelSerializer):
>  
>      class Meta:
>          model = User
> -        fields = ('url', 'username', 'first_name', 'last_name', 'email')
> +        fields = ('id', 'url', 'username', 'first_name', 'last_name', 'email')
>          # we don't allow updating of emails via the API, as we need to
>          # validate that the User actually owns said email first
>          read_only_fields = ('username', 'email')
> -- 
> 2.7.4
>
> _______________________________________________
> Patchwork mailing list
> Patchwork at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 859 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20161121/b4193722/attachment.sig>


More information about the Patchwork mailing list