This is a lean fork of https://github.com/django-tenants/django-tenants started at version 3.8.0, https://github.com/django-tenants/django-tenants/releases/tag/v3.7.8, commit 7d82923.
It reverts the changes made in django-tenants#997 b/c they cause existing Kiwi TCMS tests to fail, django-tenants#1155, and appear to be much more disruptive than what appears initially!
This fork also removes any upstream functionality which isn't consumed in Kiwi TCMS and focuses on maintainability!
Originally Kiwi TCMS needed the rest of the changes in order to become compatible with Django 5.2, but we didn't want to risk breaking production instances hence the fork! Since then it has taken a life of its own and is only fit as a building block for https://github.com/kiwitcms/tenants/!
- Security: backport from upstream v4.0.2. See GHSA-xpxg-j6jm-rp27
- Security: backport from upstream v4.0.3. See GHSA-6j59-h5h9-h29f
- Security: backport from upstream v4.0.4. See GHSA-492h-rq3v-xf2h
- Schema names are now restricted to Kiwi TCMS'
^[a-z0-9]{1,63}$rule
- Security: escape schema names in all generated SQL using psycopg's
sql.Identifier/sql.SQLcomposition and restore the introspectionsearch_pathverbatim fromSHOW search_path - Security: schema-name validation rejects double and single quotes, backslashes, semicolons, line breaks and NUL, matching upstream v4.0.1. See GHSA-693j-7v9f-x7pw
- Remove multi-type tenant support not used in Kiwi TCMS
- Remove middleware not used in Kiwi TCMS
- Remove staticfiles module not used in Kiwi TCMS
- Remove template loaders not used in Kiwi TCMS
- Remove deprecated and unused
django_tenants.files.storages - Removed the psycopg2 fallback; psycopg 3 is required
- Add Django 6.1 support. Cherry-picked from upstream https://github.com/django-tenants/django-tenants/commit/2304f34
- Raised the minimum supported Python version to 3.12.
- Updated the test matrix to Python 3.12 and 3.14, PostgreSQL 17 and 18, and Django 5.2 and 6.0.
- Fixed
AppRegistryNotReady: Apps aren't loaded yetin the multiprocessing migration executor by explicitly using theforkstart method, which is required now that newer Python versions no longer default toforkon Linux.