Projet

Général

Profil

0001-Add-command-list_tenants-fixes-5044.patch

Benjamin Dauvergne, 28 août 2014 13:06

Télécharger (1,18 ko)

Voir les différences:

Subject: [PATCH] Add command list_tenants (fixes #5044)

 .../multitenant/management/commands/list_tenants.py      |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 entrouvert/djommon/multitenant/management/commands/list_tenants.py
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

  
0
-