summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2012-01-13 00:04:29 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2012-01-13 00:04:29 +0100
commitaaf283a81b39d6fc3d2ff493abaf14c318887a79 (patch)
treef3e85c74704acb3a9a8863e8ffe4c7fac8ab31a2 /README.rst
parent6329a894c0b148f1c8bba2ebf224201419cf44ff (diff)
downloadfactory-boy-aaf283a81b39d6fc3d2ff493abaf14c318887a79.tar
factory-boy-aaf283a81b39d6fc3d2ff493abaf14c318887a79.tar.gz
Remove deprecated examples from the doc -- explicit is better than implicit, etc.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst7
1 files changed, 4 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index f20b129..c3e0b0a 100644
--- a/README.rst
+++ b/README.rst
@@ -32,18 +32,19 @@ Source::
Defining factories
------------------
-Factories declare a set of attributes used to instantiate an object. The name of the factory is used to guess the class of the object by default, but it's possible to explicitly specify it::
+Factories declare a set of attributes used to instantiate an object. The class of the object must be defined in the FACTORY_FOR attribute::
import factory
from models import User
- # This will guess the User class
class UserFactory(factory.Factory):
+ FACTORY_FOR = User
+
first_name = 'John'
last_name = 'Doe'
admin = False
- # This will use the User class (Admin would have been guessed)
+ # Another, different, factory for the same object
class AdminFactory(factory.Factory):
FACTORY_FOR = User