Revision fbed23e8
Added by Benjamin Dauvergne over 10 years ago
entrouvert/djommon/multitenant/management/commands/list_tenants.py | ||
---|---|---|
1 |
from django.core.management.base import BaseCommand |
|
2 |
from entrouvert.djommon.multitenant.middleware import TenantMiddleware |
|
3 |
|
|
4 |
class Command(BaseCommand): |
|
5 |
requires_model_validation = True |
|
6 |
can_import_settings = True |
|
7 |
option_list = BaseCommand.option_list |
|
8 |
|
|
9 |
def handle(self, **options): |
|
10 |
all_tenants = TenantMiddleware.get_tenants() |
|
11 |
|
|
12 |
for tenant in all_tenants: |
|
13 |
print("{0} {1}".format(tenant.schema_name, tenant.domain_url)) |
|
14 |
|
Also available in: Unified diff
Add command list_tenants (fixes #5044)
refs #5106