Add command list_tenants (fixes #5044)

refs #5106
This commit is contained in:
Benjamin Dauvergne 2014-08-25 15:10:54 +02:00
parent 5c1d1ad6c9
commit fbed23e8e3
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
from django.core.management.base import BaseCommand
from entrouvert.djommon.multitenant.middleware import TenantMiddleware
class Command(BaseCommand):
requires_model_validation = True
can_import_settings = True
option_list = BaseCommand.option_list
def handle(self, **options):
all_tenants = TenantMiddleware.get_tenants()
for tenant in all_tenants:
print("{0} {1}".format(tenant.schema_name, tenant.domain_url))