[RFC 2/2] REST: Add Projects to the REST API

Andy Doan andy.doan at linaro.org
Fri Mar 25 05:57:28 AEDT 2016

On 03/24/2016 10:47 AM, Finucane, Stephen wrote:
> On 16 Mar 11:13, Andy Doan wrote:
>> This exports projects via the REST API.
>> Security Constraints:
>>   * Anyone (logged in or not) can read all projects.
>>   * Only admins can create/delete projects.
>>   * Project maintainers are allowed to update (ie "patch" project
>>     attributes)
> Assume you want this reviewed, so comments below. Generally like the
> idea though _if_ we can approach it bit by bit :)

That's my exact plan.

> So I know DRF provides its own 'APITestCase' class. Would it beneficial
> to use this?

Good tip, it will remove some boiler plate.

> * http://www.django-rest-framework.org/api-guide/testing/#test-cases
> * http://stackoverflow.com/q/28221754/613428

>> +class ProjectSerializer(serializers.HyperlinkedModelSerializer):
>> +    class Meta:
>> +        model = Project
> Should we serialize 'tags' also (read only)?

Seems sane.

NOTE: Damien's code only exposes: ('id', 'name', 'linkname', 
'listemail', 'web_url', 'scm_url', 'webscm_url'). ie 
"send_notifications" and "use_tags" are hidden. I didn't see why that 
would be helpful, and it also adds to development costs to have to 
remember a field added to models.Project means a change needed for this. 
Does this make sense?

More information about the Patchwork mailing list