diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-03-05 23:12:10 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-03-05 23:12:10 +0100 |
commit | 114ac649e448e97a210cf8dccc6ba50278645ce6 (patch) | |
tree | 705da01544a66d5602624d4d3813ac7ffef45382 /docs | |
parent | d01f5e6c041395bc579f58e12e7034a08afe3f14 (diff) | |
download | factory-boy-114ac649e448e97a210cf8dccc6ba50278645ce6.tar factory-boy-114ac649e448e97a210cf8dccc6ba50278645ce6.tar.gz |
Stop calling Foo.objects.create() when it doesn't break (Closes #23).
This will be properly fixed in v2.0.0; the current heuristic is:
- If the user defined a custom _create method, use it
- If he didn't, but the associated class has a objects attribute, use TheClass.objects.create(*args, **kwargs)
- Otherwise, simply call TheClass(*args, **kwargs).
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/reference.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/reference.rst b/docs/reference.rst index 6d01e5d..03023fc 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -235,6 +235,15 @@ factory_boy supports two main strategies for generating instances, plus stubs. .. OHAI_VIM* + .. warning:: For backward compatibility reasons, the default behaviour of + factory_boy is to call ``MyClass.objects.create(*args, **kwargs)`` + when using the ``create`` strategy. + + That policy will be used if the + :attr:`associated class <Factory.FACTORY_FOR>` has an ``objects`` + attribute *and* the :meth:`~Factory._create` classmethod of the + :class:`Factory` wasn't overridden. + .. function:: use_strategy(strategy) |