[PATCH v6 07/10] REST: Add Patch Checks to the API

Finucane, Stephen stephen.finucane at intel.com
Tue Jun 28 03:06:35 AEST 2016


On 16 Jun 16:13, Andy Doan wrote:
> This exports patch checks via the REST API.
> 
> The drf-nested-routers package is used to handle the fact Checks are
> nested under a Patch.
> 
> Security Constraints:
>  * Anyone (logged in or not) can read all objects.
>  * No one can update/delete objects.
>  * Project maintainers and patch owners may create objects.
> 
> Signed-off-by: Andy Doan <andy.doan at linaro.org>

I made some changes to this to make the 'date' field read-only (think
there was some miscommunication here). After this:

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

> +class ChecksSerializer(ModelSerializer):
> +    class Meta:
> +        model = Check

I added:

    read_only_fields = ('date', )

> +    user = HyperlinkedRelatedField(
> +        'user-detail', read_only=True, default=CurrentUserDefault())
> +    patch = HiddenField(default=CurrentPatchDefault())
> +    date = DateTimeField(required=True)

...and I removed this ^^^.


More information about the Patchwork mailing list