Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Add docs for Filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
pmg103 authored Nov 14, 2019
1 parent fbc9757 commit 4c87462
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,16 @@ class UsersCompletedCount(SerializationSpecPlugin):
```

Plugins may also refer to `self.key` if they need to know the key beneath which they were inserted into the `serialization_spec`.

## Filtered
`Filtered` works much like a Plugin but is handled differently in the implementation. It used where the set of values needed on a 1:M relation should have a filter applied to it. It takes a [django `Q()` object](https://docs.djangoproject.com/en/2.2/topics/db/queries/#complex-lookups-with-q-objects) as well as a child serialization spec:

```python
serialization_spec = [
# ...
{'users': Filtered(Q(completed=True), [
'id',
'full_name',
]}
]
```

0 comments on commit 4c87462

Please sign in to comment.