summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
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