summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorobiwanus <ivan@ivanovs.info>2012-12-05 20:52:51 +0400
committerRaphaël Barrois <raphael.barrois@polyconseil.fr>2012-12-09 01:35:42 +0100
commit85ded9c9dc0f1c0b57d360b4cf54fe1aba2f8ca7 (patch)
tree7fe80e23d072819be328a164b7a3ffdb67b7a766
parentb449fbf4d9f7d9b93b1c0f400cf562953b209534 (diff)
downloadfactory-boy-85ded9c9dc0f1c0b57d360b4cf54fe1aba2f8ca7.tar
factory-boy-85ded9c9dc0f1c0b57d360b4cf54fe1aba2f8ca7.tar.gz
Add classmethod decorator to child factories methods
Closes #33,#34 Signed-off-by: Raphaël Barrois <raphael.barrois@polyconseil.fr>
-rw-r--r--factory/base.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/factory/base.py b/factory/base.py
index 8de652d..3d3d383 100644
--- a/factory/base.py
+++ b/factory/base.py
@@ -661,6 +661,7 @@ class DjangoModelFactory(Factory):
except IndexError:
return 1
+ @classmethod
def _create(cls, target_class, *args, **kwargs):
"""Create an instance of the model, and save it to the database."""
return target_class._default_manager.create(*args, **kwargs)
@@ -670,6 +671,7 @@ class MogoFactory(Factory):
"""Factory for mogo objects."""
FACTORY_ABSTRACT = True
+ @classmethod
def _build(cls, target_class, *args, **kwargs):
return target_class.new(*args, **kwargs)