Skip to main content

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.

Project details


Download files

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

Source Distribution

dj-termsearch-0.2.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dj_termsearch-0.2.0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dj-termsearch-0.2.0.tar.gz.

File metadata

  • Download URL: dj-termsearch-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dj-termsearch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2a928f1cc3614ae11179dd7463005d7e97ce966fca45cb1bfe5c88d2872bc990
MD5 04488e61fa1b57b12b18b39fa3b22414
BLAKE2b-256 b7486dae13b2e7641bb174f786d7b4d5699d70da6dd7dce2f6e1c08290363e2c

See more details on using hashes here.

File details

Details for the file dj_termsearch-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dj_termsearch-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23a35db29956398cfd404eb88298022dff3bf9a1b8b6e4819efd3f6c250fc2ff
MD5 f2b8eca75663c4ebeb64b473f22a1380
BLAKE2b-256 d4f6e254708b15a752f04f7917953eefcdc21d89ca592d1d3f9cd5ddfffc2ac0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page