-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically filter by the parent resource #177
Conversation
@TMiguelT @akira-dev so is there is no reason of having this boilerplate as in the documentation now? So is ComputerList as the below snippet required?:
It doesn't look like this feature doesn't work at my end. |
Are you referring to the |
Thanks @TMiguelT for your reply. I tried PersonDetail after removing
I was expecting the issue to filter ResourceList type relationships, which just have one associated id to be resolved with this issue. Yet I am getting the same behaviour where calling I checked that my flask_rest_json_api version is 0.31.2 itself I am sharing my complete version of getting started guide code here |
So in your case, I think the problem is that you need to have the route defined as: |
Ok, now it works on changing the route:
Thanks! |
Yes, I think this should also work for resource lists like |
On running the
The full code can be found here |
Ah it's been a while since I wrote this PR but I believe that there are two things I never made clear:
|
Thank you very much @TMiguelT your explanation helps a lot. |
I tried |
Closes #176.
Broadly this adds a new argument,
filters
, to theget_collection()
data layer, and then uses this argument to filter theResourceList
so that it only returns results attached to a parent resource, e.g.GET /articles/1/comments
should only return comments for article 1.