I have this configuration in the settings.py to work with sql server that works fine
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'almaceninterno',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': 'localhost',
'PORT': '5432',
},'conexion2': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'almacenexterno',
'USER': 'sa',
'PASSWORD': '123456789',
'HOST': 'localhost',
'PORT': '',
'OPTIONS': {
'driver': 'SQL Server Native Client 10.0',
}
}
but I want to do the following with the connection2
'conexion2': {
'ENGINE': 'sql_server.pyodbc',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
'OPTIONS': {
'driver': 'SQL Server Native Client 10.0',
}
}
and fill the missing data in a class in the view through ajax where the host, user and password first put me to perform the following query SELECT name FROM master.dbo.sysdatabases where name! = 'Master' and name! = 'Model' and name! = 'Msdb' and name! = 'ReportServer' and name! = 'ReportServerTempDB' and name! = 'Tempdb' that would show a select with the list of the databases, for later in another class complete the connection to the chosen database and save that connection data in a table that is in the default database, I hope you can help me.