Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Simple term searches for Django CBV's.

Project Description

Simple GET-based term searches for Django CBV’s.

Documentation

The full documentation is at https://dj-termsearch.readthedocs.org.

Quickstart

Install dj-termsearch:

pip install dj-termsearch

Add "termsearch" to your INSTALLED_APPS then just add TermSearchMixin to a view and go:

from django.db import models
from termsearch.views import TermSearchMixin

class MyModelListView(TermSearchMixin, ListView):

    model = MyModel
    term = "title"
    lookup = "iexact"

Check the results at:

https://example.com/list?q=barry

Advanced

Use a list of model fields to use in the search:

class AnotherListView(TermSearchMixin, ListView):

    model = MyModel
    terms = ["title", "content", "author__name"]
    lookup = "iexact"

Map each field to a lookup type:

class YetAnotherListView(TermSearchMixin, ListView):

    model = MyModel
    term_mapping = {
        "title": "icontains",
        "tags__name": "iexact",
        "author__surname": "exact",
    }

History

0.2.0 (2014-06-23)

  • Added separate search mixins (SingleTermSearchMixin, MultiTermSearchMixin, MapTermSearchMixin).
  • Cleanup of docs.

0.1.0 (2014-06-20)

  • First release on PyPI.

Release history Release notifications

This version
History Node

0.2.0

History Node

0.1.0

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
dj_termsearch-0.2.0-py2.py3-none-any.whl (4.5 kB) Copy SHA256 hash SHA256 Wheel 2.7 Jun 27, 2014
dj-termsearch-0.2.0.tar.gz (5.4 kB) Copy SHA256 hash SHA256 Source None Jun 23, 2014

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