django-icekit icon indicating copy to clipboard operation
django-icekit copied to clipboard

Expose MediaCategory through API

Open markfinger opened this issue 8 years ago • 3 comments

Use case is assigning categories when uploading images.

We'll need:

  • id exposed so we can reference it when adding relations
  • name exposed so we can match for get/creates before assigning relations

markfinger avatar Jun 08 '17 05:06 markfinger

The endpoint should accept have read and write access.

markfinger avatar Jun 08 '17 05:06 markfinger

@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

markfinger avatar Jun 13 '17 06:06 markfinger

@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.

jmurty avatar Jun 15 '17 11:06 jmurty