Skip to main content

ts-django-filtering

PyPI - Version

In-house solution for kwarg and attribute access based filtering of Django ORM models.

Install

$ pip install ts-django-filtering

Usage

from my_app.models import Person
from django_filtering import Filter, FilterSet

my_filters = [
    {
        "path": "job.name",
        "operator": "iexact",
        "value": "Engineer"
    },
    {
        "path": "job.requirement.name",
        "operator": "icontains",
        "value": "Plumbing"
    },
]

filters = Filter.from_list(my_filters)
print(Filter.merge_to_dict(*filters))
# {'job__name__iexact': 'Engineer', 'job__requirement__name__icontains': 'Plumbing'}

print(FilterSet(filters=filters).filter(Person))
# <QuerySet [<Person: Person object (1)>]>

### or for instance filtering

filters = Filter.from_list([
    {
        "path": "name",
        "operator": "exact",
        "value": "Joe"
    }
])

people = [
    Person(name="Jeff"),
    Person(name="John"),
    Person(name="Joe"),
]

FilterSet(filters=filters).filter(people)
# <List [<Person: Person object("Joe")>]>

Release files for ts-django-filtering 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ts-django-filtering 1.1.0
File Size Uploaded
ts_django_filtering-1.1.0.tar.gz 19.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ts-django-filtering 1.1.0
File Interpreter ABI Platform
ts_django_filtering-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 37.8 kB

Release files / ts_django_filtering-1.1.0.tar.gz

Download URL ts_django_filtering-1.1.0.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d57f24906b9fefc5c8f6c767e8015de797e744a7bcbf4cda4d05e4a277b5e95e
BLAKE2b-256 checksum
How to use checksums
190c404ef48ff0c628eed0620045d66183da9bcd4cd430592a2344caa3e3cdec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / ts_django_filtering-1.1.0-py3-none-any.whl

Download URL ts_django_filtering-1.1.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6249714b4fce81063c98349ce98f14b220df4ee2334acb7034f4373ec12a5068
BLAKE2b-256 checksum
How to use checksums
6ca05c823554a8b5d855dc6d300c289bbdc85da7d6a12f62bcf0e138f8511d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page