_images/logo.png

https://travis-ci.org/knipknap/django-find.svg?branch=master https://coveralls.io/repos/github/knipknap/django-find/badge.svg?branch=master Code Climate https://img.shields.io/github/stars/knipknap/django-find.svg https://img.shields.io/github/license/knipknap/django-find.svg

django-find

What is django-find?

django-find is a Django app that makes it easy to add complex search functionality for the models in your project.

django-find supports two different ways to search your Django models: Query-based, or JSON-based.

By query-based, we mean that you can use statements like these to search your model:

author:"robert frost" and (title:road or chapter:2)

To make it easy to do complex searches spanning multiple models, another method is provided. For example, you may want to allow for custom searches that let the user choose which models and columns to include. In other words, a user interface like this:

Custom Search

For this, a JSON-based search functionality is provided:

{
    "Author":{"name":[[["equals","test"]]]},
    "Book": {"title":[[["notcontains","c"]]]},
    "Chapter": {"content":[[["startswith","The "]]]}
}

django-find is smart in figuring out how to join those models together and return a useful result.

django-find also provides a template tag that you can use to render a search field:

{% load find_tags %}
{% find object_list %}
{% for obj in object_list %}
    {{ obj.name }}
{% endfor %}