summaryrefslogtreecommitdiff
path: root/factory
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polyconseil.fr>2013-04-16 11:20:18 +0200
committerRaphaël Barrois <raphael.barrois@polyconseil.fr>2013-04-16 11:20:18 +0200
commit68b5872e8cbd33f5f59ea8d859e326eb0ff0c6eb (patch)
treedd78a618459ce74ef076d4179e2b8a6b8955520f /factory
parent9e17f7ef95f7951d7373d9f0f197dd21ac077725 (diff)
downloadfactory-boy-68b5872e8cbd33f5f59ea8d859e326eb0ff0c6eb.tar
factory-boy-68b5872e8cbd33f5f59ea8d859e326eb0ff0c6eb.tar.gz
Release v2.0.1v2.0.1
Diffstat (limited to 'factory')
-rw-r--r--factory/__init__.py2
-rw-r--r--factory/base.py11
2 files changed, 8 insertions, 5 deletions
diff --git a/factory/__init__.py b/factory/__init__.py
index ef5d40e..939500c 100644
--- a/factory/__init__.py
+++ b/factory/__init__.py
@@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-__version__ = '2.0.0'
+__version__ = '2.0.1'
__author__ = 'Raphaël Barrois <raphael.barrois+fboy@polytechnique.org>'
from .base import (
diff --git a/factory/base.py b/factory/base.py
index 928ea7a..0d03838 100644
--- a/factory/base.py
+++ b/factory/base.py
@@ -596,10 +596,13 @@ class DjangoModelFactory(Factory):
"(in %s.FACTORY_DJANGO_GET_OR_CREATE=%r)"
% (cls, cls.FACTORY_DJANGO_GET_OR_CREATE))
- key_fields = {}
- for field in cls.FACTORY_DJANGO_GET_OR_CREATE:
- key_fields[field] = kwargs.pop(field)
- key_fields['defaults'] = kwargs
+ if cls.FACTORY_DJANGO_GET_OR_CREATE:
+ key_fields = {}
+ for field in cls.FACTORY_DJANGO_GET_OR_CREATE:
+ key_fields[field] = kwargs.pop(field)
+ key_fields['defaults'] = kwargs
+ else:
+ key_fields = kwargs
obj, _created = manager.get_or_create(*args, **key_fields)
return obj