I'm building a multi-tenant project with django-tenant.
The issue I'm encountering is that "password" is not a valid flag option.
management.call_command(
'create_tenant_superuser',
interactive = False,
username = "user"
password = "password"
)
gives error:
TypeError: Unknown option(s) for create_tenant_superuser command: password Valid options are: ...
You can use the schema_context
[django-tenants docs] context manager to make queries to specific schemas by providing the schema name:
from django.contrib.auth import get_user_model
from django_tenants.utils import schema_context
UserModel = get_user_model()
with schema_context(schema_name):
UserModel.objects.create_superuser(username="user", password="password")