Management command for commandline querying
Project description
Copyright (c) 2009-2012 Dennis Kaarsemaker <dennis@kaarsemaker.net> A command-line interface to query the Django ORM
- Install:
python setup.py install
Add cli_query to the INSTALLED_APPLICATIONS setting in your settings.py
Usage: cd your_project_dir; ./manage.py query [options] [filters]
The django ORM will be queried with the filters on the commandline. Records will be separated with newlines, fields with the specified separator (the default is a comma). Alternatively, a template can be specified which will be passed the result of the query as the ‘objects’ variable
Query key/value pairs can be prefixed with a ‘!’ or ‘~’ to negate the query. The __in filter works, use a comma separated string of arguments
- Examples:
Display name and assettag of all mc01 servers ./manage.py query -a servers -m Server name__startswith=mc01 -f name,assettag
Get a list of name, ip, mac for all servers where the does not contain .82. ./manage.py query -a servers -m Interface !ip_address__contains=’.82.’ -f server.name,ip_address,mac_address
Use a template to get the roles, depending on mac address ./manage.py query -a servers -m Server interface__mac_address=00:17:A4:8D:E6:BC -t ‘{{ objects.0.role_set.all|join:”,” }}’
List all eth0/eth1 network interfaces ./manage.py query -a servers -m Interface name__in=eth0,eth1 -f ip_address,mac_address
Update the status of many servers at once ./manage.py query -a servers -m Server name__contains=builder- -u status=spare
Project details
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 django-cli-query-1.1.tar.gz.
File metadata
- Download URL: django-cli-query-1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21997841cc1988882f0f821ffc4cee389b8e97ed1c6d0219e68b8e5ba07f2ece
|
|
| MD5 |
0fe2718a65b215eab2438e76f167856d
|
|
| BLAKE2b-256 |
baad6aaf1343d05f0f0ee6700b635faca11344300211a74f2ed98e586f49671c
|
File details
Details for the file django-cli-query-1.1.linux-i686.tar.gz.
File metadata
- Download URL: django-cli-query-1.1.linux-i686.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43eda7fc6c9fca6f611795f115b271b5de98e025cb165254a55cddd184756475
|
|
| MD5 |
693e6b6d306897a8d217e002e03265fb
|
|
| BLAKE2b-256 |
8b798d5c1bd7ce400af0d9d24f68469b93d6f7628ca36d387e03a094a15d3ee5
|