django-tenants added, and configurated customers app

This commit is contained in:
behruz-dev
2025-11-19 16:03:31 +05:00
parent ccdf6fe2ac
commit 849e5bd6c4
21 changed files with 186 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
from django.core.management import BaseCommand
from core.apps.customers.models import Client, Domain
class Command(BaseCommand):
def handle(self, *args, **options):
client_name = input('Mijoz nomini kiriting: ')
schema_name = input('Schema nomini kiriting: ').lower()
domain = input('Domain kiriting: ').lower()
client, created = Client.objects.get_or_create(
name=client_name,
schema_name=schema_name,
)
Domain.objects.get_or_create(
domain=domain,
tenant=client,
is_primary=True
)
self.stdout("Mijoz qo'shildi")