ic-labs / django-icekit

GLAMkit is a next-generation Python CMS by the Interaction Consortium, designed especially for the cultural sector.
http://glamkit.com
MIT License
47 stars 11 forks source link

Expose MediaCategory through API #247

Open markfinger opened 7 years ago

markfinger commented 7 years ago

Use case is assigning categories when uploading images.

We'll need:

markfinger commented 7 years ago

The endpoint should accept have read and write access.

markfinger commented 7 years ago

@jmurty I've added the MediaCategory to the API on feature/media-category-api. Most of the test suite that was ported from the Image API is passing, but there's a failure associated with permissions...

https://github.com/ic-labs/django-icekit/blob/595532faebc010579de4127941b9f3bffc0757e8/icekit/api/media_category/tests.py#L84

https://travis-ci.org/ic-labs/django-icekit/builds/242293764#L1558

jmurty commented 7 years ago

@markfinger The 247-image-categories-in-api branch has updated M2M write support and uses it to make the Image API's categories field writable to assign existing or create new MediaCategory items directly in the Image API endpoint.

See the new tests at the bottom of icekit/api/images/tests.py for example usage: the way you have to specify multipart form field names is fiddly.