Hi,

I am developing a Django application with 6 different apps. This
application will be provided to n different organizations.

I want to have one database for each organization containing models
from each app and will contain organization specific data. Suppose I
have following databases


DATABASES = {
    'default': {
        'NAME': 'app_data',
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': 'root',
        'PASSWORD': 'root'
    },
    'org1': {
        'NAME': 'org1',
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': 'org1',
        'PASSWORD': 'org1'
    },
    'org2': {
        'NAME': 'org2',
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': 'org2',
        'PASSWORD': 'org2'
    }
}


I request answers to following questions.
1. Right now I have superusers for each of above three databases. Now
if I login through any one of them and create a new user, it is stored
only in default database, not in one from which my superuser belongs
to.
e.g. if i login from superuser of db 'org2' and create a new user, it
is reflected only in default database, not in db2.
How can I achieve that??

2. After I have users in different org database. When I login from
some user's credentials(I dont know which organisation), It should
check in all organisation's databases and authenticate. How can I do
it?

3. After I have authenticated the user, I know that this particular
user belongs to which organsation(suppose org1). Now all the
operations performed by this user should be bound to this database
only.

How can I achieve this?? I am able to do it with 'using' keyword in
following way. But I want to avoid writing it everywhere.

e.g. obj.save(using=user.organisation)

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to