Skip to main content

Allows users to filter Django models

Project description

Django Filtering UI

A Django app for providing a user interface (UI) to the django-filtering package.

The original usecase for the project's UI required the following:

  • Does not disrupt existing backend rendered model listings
  • provides the ability to filter on a field more than once
  • provides the ability to toggle the filtering operation (i.e. AND, OR and NOT filters operators)
  • provides the grouping of filters by operator (TODO)
  • serializes UI filter data to JSON
  • pre-validates UI filter data before sending to backend (TODO)

The UI is implemented in VueJS as a progressive web app (PWA). VueJS was used because of it's small footprint, ease of use, and progressive usage.

The UI implementation here in django-filtering-ui is separate from django-filtering because there are multiple paths to implementing a frontend behavior. I've choosen to create a PWA in VueJS, but there is nothing stopping someone from developing a solution in htmx, React, JQuery, etc.

Installation

Install via pip or the preferred package manager:

pip install django-filtering-ui

Add this package to the installed apps list in your settings.

INSTALLED_APPS=[
    #...
    'django_filtering_ui',
]

See Usage for how to integrate into your frontend.

Usage

TODO

State of development

This package is very much a work-in-progress. All APIs are completely unstable.

Testing & development

Note, I'm testing within a docker container, because I never run anything locally. There are two containers, one for each language; Python for the backend and Node for the frontend. For the moment the containers is simply run with:

docker run -d --rm --name django-filtering-ui--frontend --workdir /code -v $PWD:/code -p 5173:5173 -p 9223:9223 node:latest sleep infinity
docker run -d --rm --name django-filtering-ui--backend --workdir /code -v $PWD:/code python:3.12 sleep infinity

Testing the frontend

Execute testing commands:

docker exec django-filtering-ui--frontend npm install
docker exec django-filtering-ui--frontend npm run test

Testing the backend

Execute testing commands:

docker exec django-filtering-ui--backend pip install -e ".[tests]"
docker exec django-filtering-ui--backend pytest

Using the debugger when testing the frontend

To use the chrome debugger use the following:

npm exec -- vitest --inspect-brk 0.0.0.0:9223 --no-file-parallelism -t "$TEST_NAME" $TEST_FILE

Then open chrome://inspect and 0.0.0.0:9223 as a network target.

Building for release

At this time the package is built as follows:

# Builds the js source and outputs it into src/django_filtering_ui/static
docker exec django-filtering-ui--frontend npm run build
# Build the python package files
docker exec django-filtering-ui--backend pip install hatchling
docker exec django-filtering-ui--backend hatchling build

License

GPL v3 (see LICENSE file)

Copyright

© 2026 The Shadowserver Foundation

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_filtering_ui-0.0.11.tar.gz (101.9 kB view details)

Uploaded Source

Built Distribution

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

django_filtering_ui-0.0.11-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

Details for the file django_filtering_ui-0.0.11.tar.gz.

File metadata

  • Download URL: django_filtering_ui-0.0.11.tar.gz
  • Upload date:
  • Size: 101.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for django_filtering_ui-0.0.11.tar.gz
Algorithm Hash digest
SHA256 6b9e4b0466c76cf17e8b685c87f3887fae336476a45c12a2820b911f70e36c13
MD5 410de0bb2ba7905881381d35f2df0872
BLAKE2b-256 14c0a9ab6c6d069b44ac8b2c3a0c7e190f270de8dcdcdb079f009e573370a996

See more details on using hashes here.

File details

Details for the file django_filtering_ui-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for django_filtering_ui-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 68cdfea1cd9e5cff471f779c116dc44389a894363ddc6787e2341cd7b1e9d226
MD5 5c09fcfc6ba0751197529c3c1f9d8879
BLAKE2b-256 b2284685316cc2262b42c101ac0275b580292d049248df3fdab8443cf4a14baa

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