diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-04-21 19:53:35 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-04-21 19:53:35 +0200 |
commit | b5f0579a9050b38392f45eb8e29b51e46928584a (patch) | |
tree | 6ca523c5087e6b6d625bb6c0ef2cdbed7e999256 /docs | |
parent | 31f6f666a02bc3b19836ab996295587de2542f11 (diff) | |
download | factory-boy-b5f0579a9050b38392f45eb8e29b51e46928584a.tar factory-boy-b5f0579a9050b38392f45eb8e29b51e46928584a.tar.gz |
docs: add note to SubFactory/RelatedFactory.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/reference.rst | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/docs/reference.rst b/docs/reference.rst index 81aa645..ad91a8d 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -586,7 +586,7 @@ handles more complex cases: SubFactory """""""""" -.. class:: SubFactory(sub_factory, **kwargs) +.. class:: SubFactory(factory, **kwargs) .. OHAI_VIM** @@ -601,6 +601,18 @@ The :class:`SubFactory` attribute should be called with: factory +.. note:: When passing an actual :class:`~factory.Factory` for the + :attr:`~factory.SubFactory.factory` argument, make sure to pass + the class and not instance (i.e no ``()`` after the class): + + .. code-block:: python + + class FooFactory(factory.Factory): + FACTORY_FOR = Foo + + bar = factory.SubFactory(BarFactory) # Not BarFactory() + + Definition ~~~~~~~~~~ @@ -1040,6 +1052,18 @@ RelatedFactory keyword: +.. note:: When passing an actual :class:`~factory.Factory` for the + :attr:`~factory.RelatedFactory.factory` argument, make sure to pass + the class and not instance (i.e no ``()`` after the class): + + .. code-block:: python + + class FooFactory(factory.Factory): + FACTORY_FOR = Foo + + bar = factory.RelatedFactory(BarFactory) # Not BarFactory() + + .. code-block:: python class CityFactory(factory.Factory): |