summaryrefslogtreecommitdiff
path: root/factory/alchemy.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2014-05-18 15:10:56 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2014-05-18 15:10:56 +0200
commit3a5709527d362a960a1a35769375412e4536839e (patch)
tree0d16ff742914585556ccc55ef75cbec162f4a271 /factory/alchemy.py
parentb245a83019a8735d0c80c07275cd426bc60dd9f8 (diff)
downloadfactory-boy-3a5709527d362a960a1a35769375412e4536839e.tar
factory-boy-3a5709527d362a960a1a35769375412e4536839e.tar.gz
Rename 'target' to 'model'.
Diffstat (limited to 'factory/alchemy.py')
-rw-r--r--factory/alchemy.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/factory/alchemy.py b/factory/alchemy.py
index b956d7e..3c91411 100644
--- a/factory/alchemy.py
+++ b/factory/alchemy.py
@@ -47,7 +47,7 @@ class SQLAlchemyModelFactory(base.Factory):
def _setup_next_sequence(cls, *args, **kwargs):
"""Compute the next available PK, based on the 'pk' database field."""
session = cls._meta.sqlalchemy_session
- model = cls._meta.target
+ model = cls._meta.model
pk = getattr(model, model.__mapper__.primary_key[0].name)
max_pk = session.query(max(pk)).one()[0]
if isinstance(max_pk, int):
@@ -56,9 +56,9 @@ class SQLAlchemyModelFactory(base.Factory):
return 1
@classmethod
- def _create(cls, target_class, *args, **kwargs):
+ def _create(cls, model_class, *args, **kwargs):
"""Create an instance of the model, and save it to the database."""
session = cls._meta.sqlalchemy_session
- obj = target_class(*args, **kwargs)
+ obj = model_class(*args, **kwargs)
session.add(obj)
return obj