django-cli-query

Management command for command-line querying
Download

django-cli-query Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • Dennis Kaarsemaker
  • Publisher web site:
  • http://www.kaarsemaker.net/files/Software/

django-cli-query Tags


django-cli-query Description

django-cli-query is 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.pyUsage: cd your_project_dir; ./manage.py query The django ORM will be queried with the filters on the commandline. Recordswill 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' variableQuery key/value pairs can be prefixed with a '!' or '~' to negate the query.The __in filter works, use a comma separated string of argumentsExamples: - 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=spareProduct's homepage


django-cli-query Related Software