Skip to main content
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.9+, Django 4.2/5.1/5.2, and is optionally compatible with Django REST Framework 3.11+.

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.

Release files for django-querysetsequence 0.18

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.18
File Size Uploaded
django_querysetsequence-0.18.tar.gz 30.4 kB Details

Built distribution (wheel)

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

Total release size: 46.7 kB

Release files / django_querysetsequence-0.18.tar.gz

Download URL django_querysetsequence-0.18.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
008435bd44cf291de21238d26efda4a14f4dcb5f01adb19da8339f634f3a9338
BLAKE2b-256 checksum
How to use checksums
cef622906bc0d74b17bd8203e7038b1159f8b228426a3ad24b0912388dcf980e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

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

Download URL django_querysetsequence-0.18-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e63956ecb272430cb5d302179b4baa1361f11078eba9f1d45f37227d691676e
BLAKE2b-256 checksum
How to use checksums
effc57279c6ec7046b25cc09f4920c0322c9fc14f6aa7797623ae6a3ec807cd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.18 This release

2 release files

0.17

2 release files

0.16

2 release files

0.15

2 release files

0.14

2 release files

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10

1 release file

0.9

1 release file

0.8

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7

1 release file

0.6.1

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.1

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