summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-08-05 19:02:25 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-08-05 19:03:38 +0200
commit5730d4ac18f8684c37168033ef32d1ee31f5e4a1 (patch)
treebfd9a512eef010b536440efcbbf2df3a0ff697b0 /docs
parent1c473f9b3e3ba216c37df7ce7393d8c3742fa054 (diff)
downloadfactory-boy-5730d4ac18f8684c37168033ef32d1ee31f5e4a1.tar
factory-boy-5730d4ac18f8684c37168033ef32d1ee31f5e4a1.tar.gz
Clarify intro doc about @lazy_attribute.
Diffstat (limited to 'docs')
-rw-r--r--docs/introduction.rst14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/introduction.rst b/docs/introduction.rst
index 4dc1168..41c6f7b 100644
--- a/docs/introduction.rst
+++ b/docs/introduction.rst
@@ -140,7 +140,19 @@ taking the object being built and returning the value for the field:
<User: user3 (doe@example.com)>
-.. note:: As for :class:`~factory.Sequence`, a :meth:`~factory.@lazy_attribute` decorator is available.
+.. note:: As for :class:`~factory.Sequence`, a :meth:`~factory.@lazy_attribute` decorator is available:
+
+
+.. code-block:: python
+
+ class UserFactory(factory.Factory):
+ FACTORY_FOR = models.User
+
+ username = factory.Sequence(lambda n: 'user%d' % n)
+
+ @factory.lazy_attribute
+ def email(self):
+ return '%s@example.com' % self.username
Inheritance