{"categories":[{"label":"Database","url":"https://skillfed.io/packages/category/database/4"}],"enrichment":{"capability":"Adds multi-tenant database support to Django by automatically scoping queries to a tenant context, enabling efficient query routing in distributed databases like Postgres+Citus.","skillfed_tags":["multi-tenant","saas","citus"],"use_cases":["Building SaaS applications where multiple customers share infrastructure but need data isolation at the database level.","Scaling Django apps on Postgres+Citus by automating tenant_id inclusion in all queries without manual filtering.","Implementing composite foreign keys with tenant_id at the database layer to enforce referential integrity across tenant boundaries.","Setting up multi-tenant middleware that automatically scopes all ORM operations to the current request's tenant.","Migrating monolithic Django apps to a shared-table multi-tenant architecture without rewriting query logic."],"what_it_does":"django-multitenant is a Django library that implements multi-tenant database patterns where all tenants share the same tables but are isolated by a tenant_id column. It automatically injects tenant context into queries, allowing databases like Postgres+Citus to route queries efficiently to the correct shard or node without requiring separate databases or schemas per tenant.\n\nThe library provides two integration patterns: inherit from TenantModel or use TenantModelMixin with your existing Django models. It replaces standard ForeignKey with TenantForeignKey to maintain tenant relationships and includes middleware utilities to set tenant context per request. This approach scales horizontally by letting the database layer handle tenant-aware query routing rather than application-level filtering.","worth_installing":"Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and solves a specific architectural problem (shared-table multi-tenancy) that would otherwise require manual tenant filtering throughout your codebase. Install it if you are building a multi-tenant Django application on Postgres+Citus or similar distributed databases."},"id":"django-multitenant","links":{"html":"https://skillfed.io/packages/django-multitenant","md":"https://skillfed.io/packages/django-multitenant.md","pypi":"https://pypi.org/project/django-multitenant/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2023-12-18","license_spdx":null,"license_treatment":"permissive","name":"django-multitenant","python_support":"unspecified","summary":"Django Library to Implement Multi-tenant databases"},"popularity":{"monthly_downloads":169585,"position":10416,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"4.1.1"}
