diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-08-28 01:30:15 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2013-08-28 01:30:15 +0200 |
commit | 297a111cc918c6451f1b66e3fe3572a9f3fc6b8f (patch) | |
tree | 1b7d68414a71b8e072b285d1a142da2ad3fc75af /docs | |
parent | 7fc3e4cbdae050dcde49ea3101636ddf57d6c96d (diff) | |
download | factory-boy-297a111cc918c6451f1b66e3fe3572a9f3fc6b8f.tar factory-boy-297a111cc918c6451f1b66e3fe3572a9f3fc6b8f.tar.gz |
Allow FACTORY_FOR = 'app.Model' for Django (Closes #66).
Diffstat (limited to 'docs')
-rw-r--r-- | docs/orms.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/orms.rst b/docs/orms.rst index 611a9ae..8215fe6 100644 --- a/docs/orms.rst +++ b/docs/orms.rst @@ -32,6 +32,8 @@ All factories for a Django :class:`~django.db.models.Model` should use the This class provides the following features: + * The :attr:`~factory.Factory.FACTORY_FOR` attribute also supports the ``'app.Model'`` + syntax * :func:`~factory.Factory.create()` uses :meth:`Model.objects.create() <django.db.models.query.QuerySet.create>` * :func:`~factory.Factory._setup_next_sequence()` selects the next unused primary key value * When using :class:`~factory.RelatedFactory` or :class:`~factory.PostGeneration` @@ -47,7 +49,7 @@ All factories for a Django :class:`~django.db.models.Model` should use the .. code-block:: python class UserFactory(factory.django.DjangoModelFactory): - FACTORY_FOR = models.User + FACTORY_FOR = 'myapp.User' # Equivalent to ``FACTORY_FOR = myapp.models.User`` FACTORY_DJANGO_GET_OR_CREATE = ('username',) username = 'john' |