Skip to main content

Django QuerySetSequence

https://img.shields.io/pypi/v/django-querysetsequence.svg https://github.com/clokep/django-querysetsequence/actions/workflows/main.yml/badge.svg Documentation Status

django-querysetsequence adds helpers for treating multiple disparate QuerySet obejcts as a single QuerySet. This is useful for passing into APIs that only accepted a single QuerySet.

The QuerySetSequence wrapper is used to combine multiple QuerySet instances.

Overview

QuerySetSequence aims to provide the same behavior as Django’s QuerySets, but applied across multiple QuerySet instances.

Supported features:

  • Methods that take a list of fields (e.g. filter(), exclude(), get(), order_by()) must use fields that are common across all sub-QuerySets.

  • Relationships across related models work (e.g. 'foo__bar', 'foo', or 'foo_id'). syntax).

  • The sub-QuerySets are evaluated as late as possible (e.g. during iteration, slicing, pickling, repr()/len()/list()/bool() calls).

  • Public QuerySet API methods that are untested/unimplemented raise NotImplementedError.

Getting Started

Install the package using pip.

pip install --upgrade django-querysetsequence

Basic Usage

# Import QuerySetSequence
from queryset_sequence import QuerySetSequence

# Create QuerySets you want to chain.
from .models import SomeModel, OtherModel

# Chain them together.
query = QuerySetSequence(SomeModel.objects.all(), OtherModel.objects.all())

# Use query as if it were a QuerySet! E.g. in a ListView.

Project Information

django-querysetsequence is released under the ISC license, its documentation lives on Read the Docs, the code on GitHub, and the latest release on PyPI. It supports Python 3.11+, Django 5.2/6.0/6.1, and is optionally compatible with Django REST Framework 3.16+.

Some ways that you can contribute:

  • Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.

  • Fork the repository on GitHub to start making your changes.

  • Write a test which shows that the bug was fixed or that the feature works as expected.

  • Send a pull request and bug the maintainer until it gets merged and published.

Metadata

Release files for django-querysetsequence 0.19

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

Source distribution (sdist)

Source distribution for django-querysetsequence 0.19
File Size Uploaded Provenance Actions
django_querysetsequence-0.19.tar.gz 38.1 kB Without provenance Details for django_querysetsequence-0.19.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-querysetsequence 0.19
File Interpreter ABI Platform Actions
django_querysetsequence-0.19-py3-none-any.whl Python 3 none any Details for django_querysetsequence-0.19-py3-none-any.whl

Total release size: 56.9 kB

Release files / django_querysetsequence-0.19.tar.gz

Download URL django_querysetsequence-0.19.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f30ccaaeff5246e68c2a08832829d74ed94507c71fec488c47f30ba7ef879ae0
BLAKE2b-256 checksum
How to use checksums
8c2ed0b913d10dfa377d9ee199a022f8d4beeca47523795b2ad6313a4a696569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / django_querysetsequence-0.19-py3-none-any.whl

Download URL django_querysetsequence-0.19-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d988beb1d2b92dd27ad9c4cf8e32b18c4001d7a3c733275a11c0d35b00613c6c
BLAKE2b-256 checksum
How to use checksums
36b9f48580d8fb6ea95dedfbf50dff422938b8a11163664523ed9a455067ba77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for django-querysetsequence 0.19

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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