Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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, 3.4 and 3.5
  • Django 1.4 through to 1.10
  • (optionally) Django REST Framework 3.3 and 3.4

Documentation

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

Release History

Release History

This version
History Node

0.0.10

History Node

0.0.9

History Node

0.0.8

History Node

0.0.7

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_filternaut-0.0.10-py3-none-any.whl (11.2 kB) Copy SHA256 Checksum SHA256 py3 Wheel Feb 13, 2017
django-filternaut-0.0.10.tar.gz (8.2 kB) Copy SHA256 Checksum SHA256 Source Feb 13, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting