Skip to content

Instantly share code, notes, and snippets.

@luzfcb
Forked from douglasmiranda/gist:5562732
Created May 12, 2013 23:16
Show Gist options
  • Save luzfcb/5565326 to your computer and use it in GitHub Desktop.
Save luzfcb/5565326 to your computer and use it in GitHub Desktop.
# O select você faz normal usando o 'using' para indicar a database específica
# algo como: Usuario.objects.using('database_test')
from django import forms
# ...
class UsuarioForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(ContentForm, self).__init__(*args, **kwargs)
self.fields["user"].queryset = Usuario.objects.using('database_test')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment