summaryrefslogtreecommitdiff
path: root/docs/reference.rst
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-06-14 23:36:25 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-06-14 23:36:25 +0200
commit1ba20b0ed7b920fa2d161df94a0dda3d93b1e14b (patch)
treebcf4d4291b0f451dce533ff244f87fb088b90a34 /docs/reference.rst
parent251ae29b4beedd7e9af721ceabb82a03f2d55bab (diff)
downloadfactory-boy-1ba20b0ed7b920fa2d161df94a0dda3d93b1e14b.tar
factory-boy-1ba20b0ed7b920fa2d161df94a0dda3d93b1e14b.tar.gz
Properly handle passed-in None in RelatedFactory (Closes #62).
Thanks to @Dhekke for the help!
Diffstat (limited to 'docs/reference.rst')
-rw-r--r--docs/reference.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/reference.rst b/docs/reference.rst
index a2d6c9a..74f2dbd 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -1157,6 +1157,22 @@ Extra kwargs may be passed to the related factory, through the usual ``ATTR__SUB
>>> City.objects.get(capital_of=england)
<City: London>
+If a value if passed for the :class:`RelatedFactory` attribute, this disables
+:class:`RelatedFactory` generation:
+
+.. code-block:: pycon
+
+ >>> france = CountryFactory()
+ >>> paris = City.objects.get()
+ >>> paris
+ <City: Paris>
+ >>> reunion = CountryFactory(capital_city=paris)
+ >>> City.objects.count() # No new capital_city generated
+ 1
+ >>> guyane = CountryFactory(capital_city=paris, capital_city__name='Kourou')
+ >>> City.objects.count() # No new capital_city generated, ``name`` ignored.
+ 1
+
PostGeneration
""""""""""""""