dabapps / django-rest-framework-serialization-spec

DEPRECATED, see https://github.com/dabapps/django-readers instead
MIT License
11 stars 0 forks source link

Add `Filtered` for filtering subqueries #29

Closed pmg103 closed 4 years ago

pmg103 commented 4 years ago

If you want to filter the returned values, use Filtered() on the right hand side, passing a Q object before the child spec

https://github.com/dabapps/django-rest-framework-serialization-spec/issues/26#issuecomment-553520748

Usage:

serialization_spec = [
    {'reportgenerationbatch_set': Filtered(Q(session=None), [
        'comparison_group',
        'report_templates',
    ])},