Releases: citusdata/django-multitenant
Releases · citusdata/django-multitenant
Set multi current tenants
In this version is introduced the concept of having multiple tenants as the current one making it possible to do
set_current_tenant([tenant_1, tenant_2])
It will add to the filter tenant_id__in=current_tenant
instead of tenant_id=current_tenant
Fix create with current tenant
In version 2.0.6, a bug was introduced when doing
set_current_tenant(my_tenant)
MyModel.objects.create(name='test')
the tenant column wasn't filled. This fixes the issue
Recursive loop fix
Fix recursive loop in warning for fields when joining without current_tenant set
v1.1
- Add TenantForeignKey to emulate composite foreign keys between tenant related models.
- Split apart library into multiple files. Importing the utility function
get_current_tenant
would cause errors due to the import statement triggering evaluation of the TenantModel class. This would cause problems if TenantModel were evaluated before the database backend was initialized. - Added a simple TenantOneToOneField which does not try to enforce a uniqueness constraint on the ID column, but preserves all the relationship semantics of using a traditional OneToOneField in Django.
- Overrode Django's DatabaseSchemaEditor to produce foreign key constraints on composite foreign keys consisting of both the ID and tenant ID columns for any foreign key between TenantModels
- Monkey-patched Django's DeleteQuery implementation to include tenant_id in its SQL queries.