Skip to main content
Help us improve Python packaging – donate today!

Recurring event tools for django

Project Description

Django simple search provides the same functionality and convenience that search_fields does in the django admin.

See for more details.

Circle CI codecov Latest Version


Download the source from and run python install, or:

> pip install django-simple-search

Django 1.8 or higher is required.

Quick start

from simple_search import search_filter
from .models import MyModel

query = 'test'
search_fields = ['^title', 'description', '=id']
f = search_filter(search_fields, query)
filtered = MyModel.objects.filter(f)

For convenience you can create a search form class via the provided factory:

from .models import MyModel
from simple_search import search_form_factory

SearchForm = search_form_factory(MyModel.objects.all(),
                                 ['^title', 'description'])


simple_search.search_filter(search_fields, query)

Given a list of search_fields to search on and a query, return a models.Q object which can be used to filter a queryset.

search_fields behaves exactly like the django admin search_fields option. Example:

search_fields = [
    # match from the start of the title field

    # match anywhere within the description field

    # match from the start of the related category's title field

    # exact match on object id

simple_search.search_form_factory(queryset, search_fields)

Create a search form class which will filter queryset according to search_fields and the form field q. Example:

from .models import MyModel
from simple_search import search_form_factory

SearchForm = search_form_factory(MyModel.objects.all(),
                                 ['^title', 'description'])

from django.shortcuts import render
from .forms import SearchForm

def search(request):
    form = SearchForm(request.GET or {})
    if form.is_valid():
        results = form.get_queryset()
        results = MyModel.objects.none()

    return {
        'form': form,
        'results': results,

Running tests

Use tox (

> pip install tox
> cd path-to/django-simple-search
> tox

Release history Release notifications

This version
History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-simple-search-1.0.2.tar.gz (5.0 kB) Copy SHA256 hash SHA256 Source None Mar 20, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page