Is it possible to filter a PrimaryKeyRelatedField? #8195
Unanswered
kevinrenskers
asked this question in
Question & Answer
Replies: 1 comment
-
use https://www.django-rest-framework.org/api-guide/fields/#serializermethodfield or else we can override PrimaryKeyRelatedField class with get_queryset() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is is possible to filter the array of results of a PrimaryKeyRelatedField? For example, take this serializer:
Currently it always includes all the characters per quest, but how can I add a filter to that? In my case characters can be hidden, but why if you use a soft-delete method and have an
is_deleted
property on the character model, and you want to exclude such characters from the quest(s)?For more background on this question you could check out this StackOverflow question that I've created which has a lot more details.
Beta Was this translation helpful? Give feedback.
All reactions