Specify the database for a Django ModelForm instance
Ben Finney
ben+python at benfinney.id.au
Tue Aug 9 21:09:09 EDT 2016
Phil Boutros <philb at philb.ca> writes:
> Ben Finney <ben+python at benfinney.id.au> wrote:
> > How can I specify which database (by its alias name) a Django
> > ModelForm should use
> <snip>
> > What is the equivalent for using='foo' when instantiating a ModelForm
> > for the model, or calling its methods (ModelForm.clean, ModelForm.save,
> > etc.)?
>
> You would specify it on the save method (using the same
> "using='foo'") paremeter.
Thank you for responding.
> http://stackoverflow.com/questions/37740848/use-a-specific-database-with-a-modelform
The person who wrote that question must think very like myself.
That doesn't address the question about ‘ModelForm.clean’ or
‘ModelForm.is_valid’, though; how to tell the instance which database to
use for those?
--
\ “I love and treasure individuals as I meet them, I loathe and |
`\ despise the groups they identify with and belong to.” —George |
_o__) Carlin, 2007 |
Ben Finney
More information about the Python-list
mailing list