Serialize API fields on demand to various levels of depth
Project description
Allows clients to control which fields will be sent in the API response, now in a multidimensional nest of levels! Fields are specified in the query and separated by points determining a given depth with no limit, e.g.
# You want a list of users but you're only interested in the fields "email" and "username":
GET /users/?fields=email,username
[
{
"email": "bruno@gmail.com",
"username": "bruno"
},
{
"email": "endzel@gmail.com",
"username": "endzel"
}
]
# You want to see every field except "id" for the specific user endzel:
GET /users/2/?fields!=id
{
"username": "endzel",
"email": "endzel@gmail.com",
"drinks": "tea",
"location": {
"id": 1,
"country_name": "Spain",
"city": "Málaga"
}
}
# And, you just want to filter "username" and "city" for the "location" attribute within the user endzel:
GET /users/2/?fields=username,location.city
{
"username": "endzel",
"location": {
"city": "Málaga"
}
}
Supported Django versions: 4.2 - 6.0+. Check the CI matrix for details.
Documentation is hosted on Read The Docs.
Developers, developers, developers!
Want to contribute to the project? This is how to run the test suite:
# Get the repo (hopefully with a ⭐)
git clone https://github.com/Endzel/drf-nestedqueryfields.git
# Create and activate your virtual environment
python -m venv .venv
source .venv/bin/activate
# Install the app
pip install --editable ".[dev]"
git checkout -b myfeature
# Do your thing, and then fire the tests with
python -m pytest
Many thanks to Wim Glenn, author of the original DRF QueryFields repository from which this one was forked, that inspired me to add my two cents!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drf_nestedqueryfields-1.0.1.tar.gz.
File metadata
- Download URL: drf_nestedqueryfields-1.0.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b1e2b5563626c5cc90ac7ff152cb5ee77947452c05899e6ea1da57672c22bcb
|
|
| MD5 |
f8bdb0f038e2571f39bb02d515bd1895
|
|
| BLAKE2b-256 |
21387f2cf12b03bc50b228b26a623cfd04c8ae1444f2d4ea019fd38a4cd45a3b
|
Provenance
The following attestation bundles were made for drf_nestedqueryfields-1.0.1.tar.gz:
Publisher:
python-publish.yml on Endzel/drf-nestedqueryfields
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drf_nestedqueryfields-1.0.1.tar.gz -
Subject digest:
6b1e2b5563626c5cc90ac7ff152cb5ee77947452c05899e6ea1da57672c22bcb - Sigstore transparency entry: 1575672521
- Sigstore integration time:
-
Permalink:
Endzel/drf-nestedqueryfields@93cca28590303e84a68e7645fae93f201b3761c1 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Endzel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@93cca28590303e84a68e7645fae93f201b3761c1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file drf_nestedqueryfields-1.0.1-py3-none-any.whl.
File metadata
- Download URL: drf_nestedqueryfields-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4839616f05b79ab818d3a4864d192a234cf8d5266a77d7a5bc3aadcb237ca653
|
|
| MD5 |
e32671eac2cfac627a17589f978d0214
|
|
| BLAKE2b-256 |
422b2854f6a900fbd9f27bfb0e54d13af0ffbb720a41c32ea4a550d3f415da99
|
Provenance
The following attestation bundles were made for drf_nestedqueryfields-1.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on Endzel/drf-nestedqueryfields
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drf_nestedqueryfields-1.0.1-py3-none-any.whl -
Subject digest:
4839616f05b79ab818d3a4864d192a234cf8d5266a77d7a5bc3aadcb237ca653 - Sigstore transparency entry: 1575672541
- Sigstore integration time:
-
Permalink:
Endzel/drf-nestedqueryfields@93cca28590303e84a68e7645fae93f201b3761c1 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Endzel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@93cca28590303e84a68e7645fae93f201b3761c1 -
Trigger Event:
release
-
Statement type: