How can I apply a filter to a nested resource in Django REST framework?

I’m faced with the same scenario. The best solution that I’ve found is to use a SerializerMethodField and have that method query and return the desired values. You can have access to request.user in that method through self.context['request'].user.

Still, this seems like a bit of a hack. I’m fairly new to DRF, so maybe someone with more experience can chime in.

Leave a Comment