{"id":23606,"library":"django-tenant-users","title":"django-tenant-users","description":"Extends django-tenants to add global multi-tenant user support, allowing users to belong to multiple tenants with per-tenant permissions. Current version 2.2.1, requires Python >=3.9, compatible with Django 4.2+, s. Release cadence: irregular, ~3-4 minor versions per year.","status":"active","version":"2.2.1","language":"python","source_language":"en","source_url":"https://github.com/Corvia/django-tenant-users","tags":["django","multi-tenant","saas","authentication","django-tenants"],"install":[{"cmd":"pip install django-tenant-users","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"UserTenantPermissions was moved to permissions submodule in v2.0","wrong":"from tenant_users.models import UserTenantPermissions","symbol":"UserTenantPermissions","correct":"from tenant_users.permissions.models import UserTenantPermissions"},{"note":"Mixin moved to tenants submodule in v2.0","wrong":"from tenant_users.models import TenantUserMixin","symbol":"TenantUserMixin","correct":"from tenant_users.tenants.models import TenantUserMixin"},{"note":"No common wrong import found","symbol":"AbstractBaseUserFacade","correct":"from tenant_users.tenants.models import AbstractBaseUserFacade"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    ...\n    'tenant_users',\n    'django_tenants',  # required dependency\n]\n\n# urls.py\nfrom django.urls import include, path\nfrom tenant_users.tenants.urls import get_tenant_urls\n\nurlpatterns = [\n    path('tenant/', include(get_tenant_urls())),\n]\n\n# Create a tenant user (shell)\n# from tenant_users.tenants.models import User\n# u = User.objects.create_user(email='user@example.com', password='secret', is_active=True)\n# tenant = Tenant.objects.create(name='My Tenant', schema_name='my_tenant')\n# u.add_tenant(tenant, is_admin=True)","lang":"python","description":"Minimal setup: add 'tenant_users' to INSTALLED_APPS and include tenant URLs."},"warnings":[{"fix":"Update imports: from tenant_users.tenants.models import TenantUserMixin, from tenant_users.permissions.models import UserTenantPermissions.","message":"In v2.0, import paths changed significantly. All models and utilities formerly in 'tenant_users.models' are now split into submodules (e.g., 'tenant_users.tenants.models', 'tenant_users.permissions.models').","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update code that calls provision_tenant to use the returned tenant object.","message":"provision_tenant utility function now returns the created tenant (v2.0.0). Previously it returned nothing.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade to v2.1.2 or later.","message":"UserTenantPermissions caching bug in remove_user (fixed in v2.1.2) could cause stale permissions after user removal from a tenant.","severity":"gotcha","affected_versions":"<2.1.2"},{"fix":"Upgrade to v2.1.3 or later.","message":"schema_required decorator in v2.1.2 and earlier had a bug related to connection state restoration (fixed in v2.1.3).","severity":"gotcha","affected_versions":">=2.0.0,<2.1.3"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from tenant_users.permissions.models import UserTenantPermissions'","cause":"In v2.0, UserTenantPermissions was moved to tenant_users.permissions.models.","error":"ImportError: cannot import name 'UserTenantPermissions' from 'tenant_users.models'"},{"fix":"Remove duplicate app entry; only include 'tenant_users' once.","cause":"Having both 'django-tenant-users' and another app named 'tenant_users' in INSTALLED_APPS.","error":"django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: tenant_users"},{"fix":"Make your user model inherit from TenantUserMixin (from tenant_users.tenants.models) and set AUTH_USER_MODEL.","cause":"User model is not using TenantUserMixin from django-tenant-users.","error":"AttributeError: 'User' object has no attribute 'add_tenant'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}