I am new to working with multi-tenant schema with django. I have followed the below link https://django-tenant-schemas.readthedocs.io/en/latest/install.html
When I creating client object, separate tenant schema is created,it's fine. but followed user is not created in separate tenant schema, it's created only in public schema. my view:
def registration(request):
form = RegistrationForm()
if request.method == 'POST': # Post method
company_name = request.POST['company_name']
website = request.POST['website']
username = request.POST['username']
f_name = request.POST['first_name']
l_name = request.POST['last_name']
email = request.POST['email']
password = request.POST['password']
confirm_password = request.POST['confirm_password']
try:
""" create Client for tenant schema"""
client =Client()
client.domain_url = 'company1.user.com'
client.schema_name = username
client.name = company_name
client.save()
""" create user"""
user = User()
user.username = username
user.first_name = f_name
user.last_name = l_name
user.email = email
user.set_password(password)
user.is_active = True
user.is_staff = True
user.save()
and I wanna change the domain url when a user login's in it redirects from the public tenant to their private client tenant account.
I am very new to this kind of functionality.
Any one can give me some guidelines or solution.