diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-02-11 01:33:51 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-03-03 18:36:09 +0100 |
commit | 5a1d9464543bcd7fdbeed1075d4461f213bede05 (patch) | |
tree | 2c5bce3c833c4d887d48b6ca31cf7368feb9c154 /docs/orms.rst | |
parent | 853ecc70f0e1772b607554e98a714675c1dc5821 (diff) | |
download | factory-boy-5a1d9464543bcd7fdbeed1075d4461f213bede05.tar factory-boy-5a1d9464543bcd7fdbeed1075d4461f213bede05.tar.gz |
Rewrite the whole documentation.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'docs/orms.rst')
-rw-r--r-- | docs/orms.rst | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/orms.rst b/docs/orms.rst new file mode 100644 index 0000000..eae31d9 --- /dev/null +++ b/docs/orms.rst @@ -0,0 +1,36 @@ +Using factory_boy with ORMs +=========================== + +.. currentmodule:: factory + + +factory_boy provides custom :class:`Factory` subclasses for various ORMs, +adding dedicated features. + + +Django +------ + + +The first versions of factory_boy were designed specifically for Django, +but the library has now evolved to be framework-independant. + +Most features should thus feel quite familiar to Django users. + +The :class:`DjangoModelFactory` subclass +""""""""""""""""""""""""""""""""""""""""" + +All factories for a Django :class:`~django.db.models.Model` should use the +:class:`DjangoModelFactory` base class. + + +.. class:: DjangoModelFactory(Factory) + + Dedicated class for Django :class:`~django.db.models.Model` factories. + + This class provides the following features: + + * :func:`~Factory.create()` uses :meth:`Model.objects.create() <django.db.models.query.QuerySet.create>` + * :func:`~Factory._setup_next_sequence()` selects the next unused primary key value + * When using :class:`~factory.RelatedFactory` attributes, the base object will be + :meth:`saved <django.db.models.Model.save>` once all post-generation hooks have run. |