]> git.ipfire.org Git - thirdparty/patchwork.git/commit
REST: Make 'Patch.state' editable
authorStephen Finucane <stephen@that.guru>
Wed, 23 Nov 2016 15:53:50 +0000 (15:53 +0000)
committerStephen Finucane <stephen@that.guru>
Fri, 23 Dec 2016 23:41:33 +0000 (23:41 +0000)
commita2993505a132764226d85ad9375abc930725d5f5
tree5a6bd1c66b7fa758afc0e8ddfbd5dd0e21613f9b
parent3e8048fc1aef396301083d1141d82de55e423418
REST: Make 'Patch.state' editable

The 'Patch.state' field is exposed by the API, but is not editable.
Tests exist that suggest the field is editable, but they lie as they
don't actually validate the field is changed (it hasn't). Make this
field editable, using a custom field type to allow said user to submit a
string representation of the state rather than an integer id.

This has the side effect of changing the output representation of the
'state' field for the '/patches' endpoint to a slugified representation,
i.e.:

    "state": "under-review",

Instead of:

    "state": "Under review",

The same slugified representation will be used in PATCH requests. This
seems more consistent with how APIs generally do this stuff making it a
"good thing" (TM).

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
Reviewed-by: Daniel Axtens <dja@axtens.net>
patchwork/api/base.py
patchwork/api/patch.py
patchwork/tests/test_rest_api.py