diff options
author | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2013-04-16 11:20:18 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2013-04-16 11:20:18 +0200 |
commit | 68b5872e8cbd33f5f59ea8d859e326eb0ff0c6eb (patch) | |
tree | dd78a618459ce74ef076d4179e2b8a6b8955520f /factory/base.py | |
parent | 9e17f7ef95f7951d7373d9f0f197dd21ac077725 (diff) | |
download | factory-boy-68b5872e8cbd33f5f59ea8d859e326eb0ff0c6eb.tar factory-boy-68b5872e8cbd33f5f59ea8d859e326eb0ff0c6eb.tar.gz |
Release v2.0.1v2.0.1
Diffstat (limited to 'factory/base.py')
-rw-r--r-- | factory/base.py | 11 |
1 files changed, 7 insertions, 4 deletions
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 |