Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A simple Django app for command-line searching via the ORM

Project Description

django_grepdb is a simple command-line app to provide basic grep-like searching of Django model fields using the ORM. Written to facilitate searching for a tag, filter, named url etc in templates in the database, but can also be used to quickly find model instances from the command line.

Quick start

  1. Add “django_grepdb” to your INSTALLED_APPS setting like this:


    or, if you have a separate settings file for development in which you extend your global settings, like this:

    INSTALLED_APPS = INSTALLED_APPS + ('django_grepdb',)
  2. Run:

    $ python grepdb <pattern> <app_label.Model.field_name>


Find instances of {% custom_template_tag.*%} in all text fields on the model EmailAction from app sprinkle, show lines containing matches, and generate admin links (if django.contrib.admin is installed):

$ python grepdb "{% custom_template_tag.*%}" sprinkle.EmailAction
<class 'sprinkle.models.EmailAction'> text_field

User registered (pk=13)
<p>Hi {% custom_template_tag user.get_full_name %},</p>

Password reset request (pk=24)
<p>Hi, {% custom_template_tag user.get_full_name %}</p>


Options are listed using $ python grepdb --help but here are some of the things you can do with django_grepdb.

Search multiple models:

$ python grepdb <pattern> sprinkle.EmailAction cms.MarkdownNode

Specify fields instead of finding all text fields:

$ python grepdb <pattern> sprinkle.EmailAction.body sprinkle.EmailAction.subject

Find all instances of CharField instead of TextField:

$ python grepdb <pattern> sprinkle.EmailAction -c

Show the whole field of a match rather than just the line:

$ python grepdb <pattern> sprinkle.EmailAction -sa

Change the hostname of the admin links:

$ python grepdb <pattern> sprinkle.EmailAction -l

Specify hostname key-value pairs in settings:

    'default': ''
    'dev': '',

$ python grepdb <pattern> sprinkle.EmailAction -l dev

Specify preset configurations in settings:

    'users': dict(identifiers=['auth.user', 'projects.userprofile'],
                  field_type=['CharField', 'TextField'],
    'templates': dict(identifiers=['sprinkle.EmailAction', 'cms.HTMLNode', 'cms.TextNode', 'cms.MarkdownNode'])

$ python grepdb <pattern> -p templates
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_grep_db-1.1.2-py2.py3-none-any.whl (16.5 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Nov 8, 2015
django-grep-db-1.1.2.tar.gz (11.0 kB) Copy SHA256 Checksum SHA256 Source Nov 8, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting