Filter dictionaries based on a list of field names.
Project description
dictfilter
installation
pip install dictfilter
usage
bsg = {
'class': 'Battlestar',
'model': 'Jupiter',
'name': 'Galactica',
'crew': {
'commander': 'William Adama',
'xo': 'Saul Tigh',
'cag': 'Kara Thrace',
}
}
result = query(some_data, ['class', 'name', 'crew.commander'])
# {
# 'class': 'Battlestar',
# 'name': 'Galactica',
# 'crew': {
# 'commander': 'William Adama',
# }
# }
django integration
Register the dictfilter middleware in settings.py
:
MIDDLEWARE = [
...
'dictfilter.django.middleware.dictfilter_middleware',
]
By default, every 2xx series response will be filtered based on a comma-separated fields
parameter in the query string.
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
dictfilter-1.1.2.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file dictfilter-1.1.2.tar.gz
.
File metadata
- Download URL: dictfilter-1.1.2.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eacaa8c69a0a423f000cbc11d10e71df1c814f5afa03cf6c6cd31d8824c0abcc |
|
MD5 | 1d4671a2a30b0871bd27668e1da05163 |
|
BLAKE2b-256 | fe0e1dcae933284c65f873de1fb8388e1c2f81165438be25cd2b97d9d862285e |
Provenance
File details
Details for the file dictfilter-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: dictfilter-1.1.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae9be59f6649b234cd73704a2c0e65a61ea4d9a1316e34535f2c4a89f937a66b |
|
MD5 | 79d2aac96952bf646f4db712d6d40102 |
|
BLAKE2b-256 | d68815905f1aa9f2b2be17964c99984ed37df11d4b9e4822739e7feb4a6f834e |