1
djangoでマルチテナントスキーマを扱うのが初めてです。私は以下のリンクに従いましたhttps://django-tenant-schemas.readthedocs.io/en/latest/install.htmldjangoを使用したマルチテナントスキーマ
私はクライアントオブジェクトを作成すると、別のテナントスキーマが作成されます。それに続くユーザーは別のテナントスキーマでは作成されません。パブリックスキーマでのみ作成されます。 私の見解:
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()
と私はそれが彼らのプライベートクライアントテナントアカウントにパブリックテナントからのリダイレクトにするとき、ユーザーがログインのドメインのURLを変更したいです。
この種の機能は非常に新しいものです。
誰でも私にいくつかのガイドラインや解決策を教えてくれます。
もう少し詳細/コードを追加してもらえますか? – radbrawler
私の見解を追加しましたそれを確認してください – neelima