Skip to main content

Construct arbitrarily complex Django "Q" filters from flat data, such as query parameters

Project description

Filternaut is a simple library which generates arbitrarily complex Django Q-objects from simple data. It fits nicely into situations where users provide data which you want to filter a queryset with.

Filternaut is indirectly a collection of fields, but it differs from Django forms in that you specify the logical relationships between fields, as well their names and types.

Filternaut is similar to Django Filters, but does not provide any machinery for rendering a user interface and does not inspect your models to autogenerate filters. However, Django Filters chains many calls to .filter() which means OR-like behaviour with more than one join. Filternaut supports either behaviour.

Quickstart

# filters are combined using logical operators
filters = (
    DateTimeFilter('created_date', lookups=['lt', 'gt']) &
    CharFilter('username', lookups=['icontains']))

# they can read their values from anything dict-like
filters.parse(request.GET)

# and have a form-like 'validity pattern'.
if filters.valid:
    queryset = queryset.filter(filters.Q)
else:
    raise HttpResponseBadRequest(json.dumps(filters.errors))

Installation

$ pip install django-filternaut

Filternaut is compatible with:

  • Python 2.7 and 3.4

  • Django 1.2 through to 1.8 alpha 1

  • Django REST Framework 2.4 and 3.0 (optional)

Documentation

See http://filternaut.readthedocs.org for full documentation.

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

django-filternaut-0.0.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distributions

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

django_filternaut-0.0.1-py3.4.egg (15.5 kB view details)

Uploaded Egg

django_filternaut-0.0.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

django_filternaut-0.0.1-py2.7.egg (18.2 kB view details)

Uploaded Egg

File details

Details for the file django-filternaut-0.0.1.tar.gz.

File metadata

File hashes

Hashes for django-filternaut-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6cee777edbab4d3befcbd4c5875ab5a16285d3878e0a775f627f1f4953407798
MD5 108e20dde916faad28f955e0d1c586b8
BLAKE2b-256 f256defd7f83b10ddfa1d31a0a54d0b9f29d336779b429664be504e5d663887f

See more details on using hashes here.

File details

Details for the file django_filternaut-0.0.1-py3.4.egg.

File metadata

File hashes

Hashes for django_filternaut-0.0.1-py3.4.egg
Algorithm Hash digest
SHA256 4eb06e1d2e86abb3dda18953f87f29cde16e729f76587a1a3e95e8ab8b0e2c11
MD5 44e27758e0103a15e7dcc4fd375dbe48
BLAKE2b-256 514bb1e8b58d63cd3a6ac68dc6e400618d29a43470e049f56bfc815da6374a08

See more details on using hashes here.

File details

Details for the file django_filternaut-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_filternaut-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5623025c89137ad5de118d49e2a38cb47d5ec4b18119afdc741e948a93871768
MD5 b7bdae348f68c14662a90b0d1bf6992a
BLAKE2b-256 b0abb5919fd8779601675886b35c9a26dab9d174d96c783e1bbcc57cfbf5eb57

See more details on using hashes here.

File details

Details for the file django_filternaut-0.0.1-py2.7.egg.

File metadata

File hashes

Hashes for django_filternaut-0.0.1-py2.7.egg
Algorithm Hash digest
SHA256 ee7d11a858779026651e5c4143c5dbbcd465346befdcb2ff8a2bb3b4574dd8e8
MD5 dd2894e7b6405e94ffd7cd2e190cbf2f
BLAKE2b-256 460341149e90cc1f3a8182ec0003ae06c0b6bb0115dc401527bd88566f66167b

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