Last active
December 31, 2015 18:46
-
-
Save bertini36/05f4129ce3fc549450bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import connection | |
from customers.models import Client | |
from contacts.models import Contact | |
tenant = Client.objects.get(name='Tenant 1') | |
connection.set_tenant(tenant) | |
# Ahora estamos conectados al Tenant 1. | |
# Todas las consultas a BD se realizarán sobre el esquema tenant1 | |
contacts = Contact.objects.all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment