Tuesday, July 23, 2013

Re: How to force modelForm.is_valid() to use a specific database?

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:


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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate