Add id
to filter fields for children-api endpoint
#625
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
The api endpoint
http://localhost:8888/api/children/
right now uses the slug of a child to do a detail query, while most filter-options for activities (tummy-time, use the child-id to implement filtering.I have encountered a bug in the Android App I am developing for which it would be handy to do a quick check for the existence of a child. It is kind of awkward to have to use the slug for this while I use a child-id for all other types of queries.
Solution
To allow for a quick "exists"-check against the database, I added the "id" flag to the filterset-fields to allow
http://localhost:8888/api/children/?id=xxx
which will solve this issue. Less awkward than traversing a potentially super-long list of child-items just to find the one you are looking for...