The problem is: when usng modelForm, it try to validate the unique key in
the database, and this validation use a default database.. if I remove
primary_key=True in my model, work fine, but I need to set the pk in my
model, because when I try to get using: obj.get(xx)  show me error...


I try every think.. and I start to think is not possible multi-db in
"runtime" in django.. :(

T.·.F.·.A.·.     S+F
*Fellipe Henrique P. Soares*

*Blog: http://fhbash.wordpress.com/*
*GitHub: https://github.com/fellipeh*
*Twitter: @fh_bash*


2013/7/23 Brian Millham <[email protected]>

> I've done that with this code:
>
> if form.is_valid():
>>   f = form.save(commit = False)
>>   f.save(using='yourdatabase')
>
>
> Works fine for me.
>
>
> On Tuesday, July 23, 2013 1:21:29 PM UTC-4, Fellipe Henrique wrote:
>>
>> I have many database setted in my setting.py   in my formModel, when I
>> try to validate the form, show me error:
>>
>> http://stackoverflow.com/**questions/17797419/modelforms-**
>> and-multiple-datasbase-error-**in-form-is-valid<http://stackoverflow.com/questions/17797419/modelforms-and-multiple-datasbase-error-in-form-is-valid>
>>
>> The problem is.. is_valid is going to "default" database... how can I
>> force to got to another database?
>>
>> Thanks.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to